Config

Description The functions in this section allow applications an easy access to the libgda configuration, thus making them able to access the list of data sources configured in the system, for instance.

Members

Static functions

addListener
uint addListener(string path, GdaConfigListenerFunc func, void* userData)

Installs a configuration listener, which is a callback function which will be called every time a change occurs on a given configuration entry.

copyDataSourceInfo
DataSourceInfo copyDataSourceInfo(DataSourceInfo src)

Creates a new GdaDataSourceInfo structure from an existing one.

findDataSource
DataSourceInfo findDataSource(string name)

Gets a GdaDataSourceInfo structure from the data source list given its name.

freeDataSourceInfo
void freeDataSourceInfo(DataSourceInfo info)

Deallocates all memory associated to the given GdaDataSourceInfo.

freeDataSourceList
void freeDataSourceList(ListG list)

Frees a list of GdaDataSourceInfo structures.

freeList
void freeList(ListG list)

Frees all memory used by the given GList, which must be the return value from either gda_config_list_sections and gda_config_list_keys.

freeProviderList
void freeProviderList(ListG list)

Frees a list of GdaProviderInfo structures.

getBoolean
int getBoolean(string path)

Gets the value of the specified configuration entry as a boolean.

getDataSourceList
ListG getDataSourceList()

Returns a list of all data sources currently configured in the system. Each of the nodes in the returned GList is a GdaDataSourceInfo. To free the returned list, call the gda_config_free_data_source_list function.

getDataSourceModel
DataModel getDataSourceModel()

Fills and returns a new GdaDataModel object using information from all data sources which are currently configured in the system. Rows are separated in 6 columns: 'Name', 'Provider', 'Connection string', 'Description', 'Username' and 'Password'.

getFloat
double getFloat(string path)

Gets the value of the specified configuration entry as a float.

getInt
int getInt(string path)

Gets the value of the specified configuration entry as an integer.

getProviderByName
ProviderInfo getProviderByName(string name)

Gets a GdaProviderInfo structure from the provider list given its name.

getProviderList
ListG getProviderList()

Returns a list of all providers currently installed in the system. Each of the nodes in the returned GList is a GdaProviderInfo. To free the returned list, call the gda_config_free_provider_list function.

getProviderModel
DataModel getProviderModel()

Fills and returns a new GdaDataModel object using information from all providers which are currently installed in the system. Rows are separated in 3 columns: 'Id', 'Location' and 'Description'.

getString
string getString(string path)

Gets the value of the specified configuration entry as a string. You are then responsible to free the returned string.

getType
string getType(string path)

Gets a string representing the type of the value of the given key. The caller is responsible of freeing the returned value.

hasKey
int hasKey(string path)

Checks whether the given key exists in the configuration system.

hasSection
int hasSection(string path)

Checks whether the given section exists in the configuration system.

listKeys
ListG listKeys(string path)

Returns a list of all keys that exist under the given path. To free the returned value, you can use gda_config_free_list.

listSections
ListG listSections(string path)

Returns a GList containing the names of all the sections available under the given root directory. To free the returned value, you can use gda_config_free_list.

removeDataSource
void removeDataSource(string name)

Removes the given data source from the GDA configuration.

removeKey
void removeKey(string path)

Removes the given entry from the configuration database. If the section is empty, also remove the section.

removeListener
void removeListener(uint id)

Removes a configuration listener previously installed with gda_config_add_listener, given its ID.

removeSection
void removeSection(string path)

Removes the given section from the configuration database.

saveDataSource
void saveDataSource(string name, string provider, string cncString, string description, string username, string password)

Adds a new data source (or update an existing one) to the GDA configuration, based on the parameters given.

saveDataSourceInfo
void saveDataSourceInfo(DataSourceInfo dsnInfo)

Saves a data source in the libgda configuration given a GdaDataSourceInfo structure containing all the information about the data source.

setBoolean
void setBoolean(string path, int newValue)

Sets the given configuration entry to contain a boolean.

setFloat
void setFloat(string path, double newValue)

Sets the given configuration entry to contain a float.

setInt
void setInt(string path, int newValue)

Sets the given configuration entry to contain an integer.

setString
void setString(string path, string newValue)

Sets the given configuration entry to contain a string.

Meta