[top] [up] [next]

Catalog methods


ODBC requires that each database driver or database implements a number of predefined SQL statements that query the catalog of a database. A database catalog contains information like the names of the tables in the database, the data types supported, the columns of a table, etc. With these queries it is possible to gather much information about a database at run-time and create generic database applications. A nice example of this is the Trinc-Prolog DBVIEW example. In this example a browse window is opened for each database connection and if the menu item 'Catalog' is opened a submenu appears that contains calls to each of the 9 standard catalog query methods.

The 9 standard catalog query methods are:

Name Description
queryTables/4 creates a result set containing names and types of database tables
queryTablePrivileges/2 creates a result set describing the user rights for a table
queryColumns/2 the result contains information about all the columns of a table
queryColumnPrivileges/3 the user rights per column of a table are listed in the result set
queryPrimaryKeys/2 the columns that make up a primary key are listed
queryForeignKeys/2 the columns that make up all foreign keys of a table are listed
queryProcedures/1 the result set contains information about all the procedures stored in the database
queryProcedureColumns/2 the input and output parameters of a single procedure are described in the result set
queryDataTypes/1 lists information about the data types supported for SQL statements

After any of these methods have been called a normal result set is created that can be iterated like any other result set.

[top] [up] [next]

 

info@trinc-prolog.com