GdaXmlDatabase

GdaXmlDatabase — XML database representation (used for import/export and in the default provider)

Functions

Types and Values

Description

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.

Functions

gda_xml_database_new ()

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.


gda_xml_database_new_from_uri ()

GdaXmlDatabase *
gda_xml_database_new_from_uri (const gchar *uri);

Creates a new GdaXmlDatabase object from a XML representation, contained in the given uri .

Parameters

uri

an uniform resource identifier.

 

Returns

the newly created object.


gda_xml_database_get_name ()

const gchar *
gda_xml_database_get_name (GdaXmlDatabase *xmldb);

Parameters

xmldb

XML database.

 

Returns

the name of the given XML database.


gda_xml_database_set_name ()

void
gda_xml_database_set_name (GdaXmlDatabase *xmldb,
                           const gchar *name);

Sets the name of the given XML database object.

Parameters

xmldb

XML database.

 

name

new name for the database.

 

gda_xml_database_get_user_version ()

const gchar *
gda_xml_database_get_user_version (GdaXmlDatabase *xmldb);

Parameters

xmldb

XML database.

 

Returns

the user defined version of the given GdaXmlDatabase object.


gda_xml_database_set_user_version ()

void
gda_xml_database_set_user_version (GdaXmlDatabase *xmldb,
                                   const gchar *user_version);

Sets the user defined version of the given XML database.

Parameters

xmldb

XML database.

 

user_version

user defined version string.

 

gda_xml_database_get_version ()

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.

Parameters

xmldb

XML database.

 

Returns

the libgda version used to create the database.


gda_xml_database_get_uri ()

const gchar *
gda_xml_database_get_uri (GdaXmlDatabase *xmldb);

Parameters

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).


gda_xml_database_set_uri ()

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).

Parameters

xmldb

XML database.

 

uri

an uniform resource identifier.

 

gda_xml_database_changed ()

void
gda_xml_database_changed (GdaXmlDatabase *xmldb);

Emits the "changed" signal for the given XML database.

Parameters

xmldb

XML database

 

gda_xml_database_reload ()

void
gda_xml_database_reload (GdaXmlDatabase *xmldb);

Reloads the given XML database from its original place, discarding all changes that may have happened.

Parameters

xmldb

XML database.

 

gda_xml_database_save ()

gboolean
gda_xml_database_save (GdaXmlDatabase *xmldb,
                       const gchar *uri);

Saves the given XML database to disk.

Parameters

xmldb

XML database.

 

uri

URI to save the XML database to.

 

Returns

TRUE if the database was successfully saved, FALSE otherwise.


gda_xml_database_to_string ()

gchar *
gda_xml_database_to_string (GdaXmlDatabase *xmldb);

Parameters

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.


gda_xml_database_get_tables ()

GList *
gda_xml_database_get_tables (GdaXmlDatabase *xmldb);

Parameters

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.


gda_xml_database_free_table_list ()

void
gda_xml_database_free_table_list (GList *list);

Frees a GList of strings returned by gda_xml_database_get_tables.

Parameters

list

list of table names, as returned by gda_xml_database_get_tables.

 

gda_xml_database_find_table ()

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.

Parameters

xmldb

XML database.

 

name

name for the table to look for.

 

Returns

a pointer to the table, or NULL if not found.


gda_xml_database_new_table ()

GdaTable *
gda_xml_database_new_table (GdaXmlDatabase *xmldb,
                            const gchar *name);

Creates a new empty table in the given XML database.

Parameters

xmldb

XML database.

 

name

name for the new table.

 

Returns

a pointer to the newly created in-memory table.


gda_xml_database_new_table_from_model ()

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.

Parameters

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.


gda_xml_database_new_table_from_node ()

GdaTable *
gda_xml_database_new_table_from_node (GdaXmlDatabase *xmldb,
                                      xmlNodePtr node);

Adds a table to the given XML database by parsing the given XML node pointer, which usually is obtained from an already loaded xmlDocPtr.

Parameters

xmldb

XML Database.

 

node

a XML node pointer.

 

Returns

a pointer to the newly created in-memory table.

Types and Values

GdaXmlDatabasePrivate

typedef struct _GdaXmlDatabasePrivate GdaXmlDatabasePrivate;

See Also

GdaTable