Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
You can programmatically retrieve result set or database structure descriptions. These descriptions are known as schema information, and this information is available through the UltraLite C API schema classes.
You can access the following schema objects and information:
Describes a query or data in a table. It exposes the identifier, name, and type information of each column, and the number of columns in the table. ULResultSetSchema classes can be retrieved from the following classes:
Exposes the number and names of the tables and publications in the database, and the global properties such as the format of dates and times. ULDatabaseSchema classes can be retrieved from ULConnection classes.
Exposes information about the column and index configurations. The column information in the ULTableSchema class complements the information available from the ULResultSetSchema class. For example, you can determine whether columns have default values or permit null values. ULTableSchema classes can be retrieved from ULTable classes.
Returns information about the column in the index. ULIndexSchema classes can be retrieved from ULTableSchema classes.
The ULResultSetSchema class is returned as a constant reference unlike the ULDatabaseSchema, ULTableSchema and ULIndexSchema classes, which are returned as pointers. You cannot close a class that returns a constant reference but you must close classes that are returned as pointers.
The following code demonstrates proper and improper use of schema class closure:
// This code demonstrates proper use of the ULResultSetSchema class: const ULResultSetSchema & rss = prepStmt->GetResultSetSchema(); c_count = prepStmt->GetSchema().GetColumnCount(); // This code demonstrates proper use of the ULDatabaseSchema class: ULDatabaseSchema * dbs = conn->GetResultSetSchema(); t_count = dbs->GetTableCount(); dbs->Close(); // This line is required. // This code demonstrates improper use of the ULDatabaseSchema class // because the object needs to be closed using the Close method: t_count = conn->GetResultSetSchema()->GetTableCount();