Datasource Meta Information

All datasources must provide functions to access their meta information. If the datasource is a database, metainformation is the names of the tables, the columns, user rights, and so on. The results from a meta information query are represented as a GdaRecordset. The problem is that most of the time the client is only interested in some part of the information. The client wants to query the data source about the indices for a table, not all indices for all tables. Therefore it is possible to pass constraints to the meta information query. But this is further complicated by he fact that each query might need to have different constraints. The following table shows which query types are implemented and which constraints are valid for each query. The constraints are passsed as name-value pairs. The name is an enum and the value is a string. The query function is a variadic function and the argument list must be closed with a enum value of 0.

The following table shows the most often used constraints and when to use them. Some schemas may require that you give a constraint.

Table 5-2. Main standard constraints' meaning

ConstraintUsageObservations
GDA_Connection_OBJECT_CATALOGUsed to specify the Database 
GDA_Connection_OBJECT_SCHEMAUsed to specify the owner 
GDA_Connection_OBJECT_NAMEUsed to specify the name of the object to query (table, ...) 
GDA_Connection_EXTRA_INFOSet it to get a more detailed answer from the providerSet it to a non NULL string (e.g. "")

The following table shows the "standard" schemas that must be supported by each GDA provider, although a specific provider may not support one of these. To test wether a schema is supported, see the gda_connection_supports() function.

Table 5-3. Standard Schema and supported constraints

Object TypeGDA identifierSupported ConstraintsReturned fieldsExtra Info
TablesGDA_Connection_GDCN_SCHEMA_TABLES GDA_Connection _OBJECT_NAME, GDA_Connection _OBJECT_CATALOG, GDA_Connection _OBJECT_SCHEMA, GDA_Connection _EXTRA_INFOname, commentsname, owner, comments, SQL definition
Tables' parents (for providers that support tables inheritance)GDA_Connection_GDCN_SCHEMA_TAB_PARENTS GDA_Connection _OBJECT_NAME (required), GDA_Connection _OBJECT_CATALOGname, order of inheritanceNot Supported
ViewsGDA_Connection_GDCN_SCHEMA_VIEWS GDA_Connection _OBJECT_NAME, GDA_Connection _OBJECT_CATALOG, GDA_Connection _OBJECT_SCHEMA, GDA_Connection _EXTRA_INFOname, commentsname, owner, comments, SQL definition
Table (or view) columnsGDA_Connection_GDCN_SCHEMA_COLUMNS GDA_Connection _OBJECT_NAME (required), GDA_Connection _OBJECT_CATALOG, GDA_Connection _OBJECT_SCHEMA, GDA_Connection _COLUMN_NAMEname, type, size, precision, nullable, is key, default value, commentsNot supported
SequencesGDA_Connection_GDCN_SCHEMA_SEQUENCES GDA_Connection _OBJECT_NAME, GDA_Connection _OBJECT_CATALOG, GDA_Connection _OBJECT_SCHEMA, GDA_Connection _EXTRA_INFOname, commentsname, owner, comments, SQL definition
ProceduresGDA_Connection_GDCN_SCHEMA_PROCS GDA_Connection _OBJECT_NAME, GDA_Connection _OBJECT_CATALOG, GDA_Connection _OBJECT_SCHEMA, GDA_Connection _EXTRA_INFOname, object Id, commentsname, object Id, owner, comments, number of arguments, SQL definition
Procedures' parametersGDA_Connection_GDCN_SCHEMA_PROC_PARAMS GDA_Connection _OBJECT_NAME (required)Usage(in, out or inout), typeNot Supported
AggregatesGDA_Connection_GDCN_SCHEMA_AGGREGATES GDA_Connection _OBJECT_NAME, GDA_Connection _OBJECT_CATALOG, GDA_Connection _OBJECT_SCHEMA, GDA_Connection _EXTRA_INFOname, object Id, In type, commentsname, object Id, In type, owner, comments, SQL definition
TypesGDA_Connection_GDCN_SCHEMA_PROV_TYPES GDA_Connection _OBJECT_NAME, GDA_Connection _OBJECT_CATALOG, GDA_Connection _OBJECT_SCHEMA, GDA_Connection _EXTRA_INFOname, owner, comments, Gda type, provider typename, comments

You must pay special attention to the constraints used (both in client applications and GDA providers), because it is required for providers to return an error if an invalid constraint is passed to the server. This is specially important, since there are schemas that may mean different things depending on the set of constraints used. As you can imagine, this could lead to the client receiving not-required data.