![]() | ![]() | ![]() | GNOME Data Access manual | ![]() |
---|
struct GdaXmlDatabasePrivate; GdaXmlDatabase* gda_xml_database_new (void); GdaXmlDatabase* gda_xml_database_new_from_uri (const gchar *uri); const gchar* gda_xml_database_get_name (GdaXmlDatabase *xmldb); void gda_xml_database_set_name (GdaXmlDatabase *xmldb, const gchar *name); const gchar* gda_xml_database_get_user_version (GdaXmlDatabase *xmldb); void gda_xml_database_set_user_version (GdaXmlDatabase *xmldb, const gchar *user_version); const gchar* gda_xml_database_get_version (GdaXmlDatabase *xmldb); const gchar* gda_xml_database_get_uri (GdaXmlDatabase *xmldb); void gda_xml_database_set_uri (GdaXmlDatabase *xmldb, const gchar *uri); void gda_xml_database_changed (GdaXmlDatabase *xmldb); void gda_xml_database_reload (GdaXmlDatabase *xmldb); gboolean gda_xml_database_save (GdaXmlDatabase *xmldb, const gchar *uri); gchar* gda_xml_database_to_string (GdaXmlDatabase *xmldb); GList* gda_xml_database_get_tables (GdaXmlDatabase *xmldb); void gda_xml_database_free_table_list (GList *list); GdaTable* gda_xml_database_find_table (GdaXmlDatabase *xmldb, const gchar *name); GdaTable* gda_xml_database_new_table (GdaXmlDatabase *xmldb, const gchar *name); GdaTable* gda_xml_database_new_table_from_model (GdaXmlDatabase *xmldb, const gchar *name, const GdaDataModel *model, gboolean add_data); GdaTable* gda_xml_database_new_table_from_node (GdaXmlDatabase *xmldb, xmlNodePtr xmlnode);
The GdaXmlDatabase class allows programs to manage databases in XML format (the format used by libgda for importing/exporting databases). It contains functions to easily manage those XML files.
With this set of functions, applications can bypass the normal libgda operation mode (via GdaClient to access data sources), and have a direct access to the data in the XML file.
GdaXmlDatabase* gda_xml_database_new (void);
Creates a new GdaXmlDatabase object, which can be used to describe a database which will then be loaded by a provider to create its defined structure.
Returns : | the newly created object. |
GdaXmlDatabase* gda_xml_database_new_from_uri (const gchar *uri);
Creates a new GdaXmlDatabase object from a XML representation, contained in the given uri.
uri : | an uniform resource identifier. |
Returns : | the newly created object. |
const gchar* gda_xml_database_get_name (GdaXmlDatabase *xmldb);
xmldb : | XML database. |
Returns : | the name of the given XML database. |
void gda_xml_database_set_name (GdaXmlDatabase *xmldb, const gchar *name);
Sets the name of the given XML database object.
xmldb : | XML database. |
name : | new name for the database. |
const gchar* gda_xml_database_get_user_version (GdaXmlDatabase *xmldb);
xmldb : | XML database. |
Returns : | the user defined version of the given GdaXmlDatabase object. |
void gda_xml_database_set_user_version (GdaXmlDatabase *xmldb, const gchar *user_version);
Sets the user defined version of the given XML database.
xmldb : | XML database. |
user_version : | user defined version string. |
const gchar* gda_xml_database_get_version (GdaXmlDatabase *xmldb);
Gets the version of libgda used to create the GdaXmlDatabase object. This version is the one that was used for saving the XML file last time it was saved. This value can only be "get" as it is an internal information related to the creation of the GdaXmlDatabase object. To get the user defined database version, use the function gda_xml_database_get_user_version instead.
xmldb : | XML database. |
Returns : | the libgda version used to create the database. |
const gchar* gda_xml_database_get_uri (GdaXmlDatabase *xmldb);
xmldb : | XML database. |
Returns : | the URI associated with the given XML database. This URI will be used when saving the XML database (gda_xml_database_save). |
void gda_xml_database_set_uri (GdaXmlDatabase *xmldb, const gchar *uri);
Associates an uri with a given XML database. This URI will be used when saving the XML database (gda_xml_database_save).
xmldb : | XML database. |
uri : | an uniform resource identifier. |
void gda_xml_database_changed (GdaXmlDatabase *xmldb);
Emits the "changed" signal for the given XML database.
xmldb : | XML database |
void gda_xml_database_reload (GdaXmlDatabase *xmldb);
Reloads the given XML database from its original place, discarding all changes that may have happened.
xmldb : | XML database. |
gboolean gda_xml_database_save (GdaXmlDatabase *xmldb, const gchar *uri);
Saves the given XML database to disk.
xmldb : | XML database. |
uri : | URI to save the XML database to. |
Returns : | TRUE if the database was successfully saved, FALSE otherwise. |
gchar* gda_xml_database_to_string (GdaXmlDatabase *xmldb);
xmldb : | a GdaXmlDatabase object. |
Returns : | the XML string representing the structure and contents of the given GdaXmlDatabase object. The returned value must be freed when no longer needed. |
GList* gda_xml_database_get_tables (GdaXmlDatabase *xmldb);
xmldb : | XML database. |
Returns : | a GList of all table names present in the given database. You must free the returned GList when you no longer need it, by using the gda_xml_database_free_table_list function. |
void gda_xml_database_free_table_list (GList *list);
Frees a GList of strings returned by gda_xml_database_get_tables.
list : | list of table names, as returned by gda_xml_database_get_tables. |
GdaTable* gda_xml_database_find_table (GdaXmlDatabase *xmldb, const gchar *name);
Searches the given XML database for a table named name, and returns a pointer to it.
xmldb : | XML database. |
name : | name for the table to look for. |
Returns : | a pointer to the table, or NULL if not found. |
GdaTable* gda_xml_database_new_table (GdaXmlDatabase *xmldb, const gchar *name);
Creates a new empty table in the given XML database.
xmldb : | XML database. |
name : | name for the new table. |
Returns : | a pointer to the newly created in-memory table. |
GdaTable* gda_xml_database_new_table_from_model (GdaXmlDatabase *xmldb, const gchar *name, const GdaDataModel *model, gboolean add_data);
Creates a new table in the given XML database from the given GdaDataModel.
xmldb : | XML database. |
name : | name for the new table. |
model : | model to create the table from. |
add_data : | whether to add model's data or not. |
Returns : | a pointer to the newly created in-memory table. |
GdaTable* gda_xml_database_new_table_from_node (GdaXmlDatabase *xmldb, xmlNodePtr xmlnode);
Adds a table to the given XML database by parsing the given XML node pointer, which usually is obtained from an already loaded xmlDocPtr.
xmldb : | XML Database. |
node : | a XML node pointer. |
Returns : | a pointer to the newly created in-memory table. |
<<< GdaXmlConnection | GdaXmlDocument >>> |