Access database and system catalog tables
Although the virtual table interface (VTI) does not provide its own function for querying tables, you can execute an SQL statement with DataBlade API functions mi_exec(), mi_prepare(), or mi_execute_prepared_statement(). SQL provides data directly from the system catalog tables and enables the access method to create tables to hold user data on the database server.
The
following example queries the system catalog table for previous statistics:
MI_CONNECTION *conn;
conn = mi_open(NULL, NULL, NULL);
/* Query system tables */
mi_exec(conn, "select tabname, nrows from systables ", MI_QUERY_NORMAL);
For
more information about querying database tables, see the HCL
Informix®
DataBlade API Programmer's Guide.
Remember: A parallelizable
UDR must not call mi_exec(), mi_prepare(), mi_execute_prepared_statement(),
or a UDR that calls these functions. A database server exception results
if a parallelizable UDR calls any UDR that prepares or executes SQL.