Datasource Meta Information

All datasources must provide functions to access their meta information. If the datasource is a database, such metainformation are the names of the tables, the columns, user rights, and so on. The results from a meta information query is represented as a Gda_Recordset. 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 want to have different constraints. The following list will show 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 6-1. 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 have 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 6-2. Standard Schema and supported constraints

Object TypeGDA identifierSupported ConstraintsReturned fieldsExtra Info
TablesGDA_Connection_GDCN_SCHEMA_TABLESGDA_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_PARENTSGDA_Connection_OBJECT_NAME (required), GDA_Connection_OBJECT_CATALOGname, order of inheritanceNot Supported
ViewsGDA_Connection_GDCN_SCHEMA_VIEWSGDA_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_COLUMNSGDA_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_SEQUENCESGDA_Connection_OBJECT_NAME, GDA_Connection_OBJECT_CATALOG, GDA_Connection_OBJECT_SCHEMA, GDA_Connection_EXTRA_INFOname, commentsname, owner, comments, SQL definition
ProceduresGDA_Connection_GDCN_SCHEMA_PROCSGDA_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_PARAMSGDA_Connection_OBJECT_NAME (required)Usage(in, out or inout), typeNot Supported
AggregatesGDA_Connection_GDCN_SCHEMA_AGGREGATESGDA_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_TYPESGDA_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.