Retrieves a list of statistics about a single table and the indexes that are associated with the table. The information is returned as a result set on the statement handle.
hstmnt = DB_Statistics (hdbc, catalog-name, schema-name, table-name, unique, reserved)
Variable | Description |
---|---|
hstmnt |
The returned handle to the executed SQL statement. This is an input parameter for other DBTester functions, for example DB_FetchNext. HSQL. |
hdbc |
The handle to a database as returned by DB_Connect. HDATABASE. |
catalog-name |
Catalog name. STRING. |
schema-name |
String search pattern for schema names. STRING. |
table-name |
String search pattern for table names. STRING. |
unique |
Type of index.
|
reserved |
Indicates the importance of the Cardinality and Pages columns in the result set.
|
Wildcard character | Matches |
---|---|
% | The percent sign matches any character sequence. |
_ | The underscore matches any single character. |
To omit a variable argument, which is not a required argument, specify the argument as an empty string ("").
Value | Meaning | Description |
---|---|---|
"0" | SQL_QUICK | The Cardinality and Page columns are retrieved only if they are readily available from the server. |
"1" | SQL_ENSURE | The statistics are retrieved unconditionally. |
When you receive a valid statement handle, you can call DB_FetchNext or DB_FetchPrevious to manipulate the information.
[ ] STRING cat, sch, tab-name, ignore [ ] INTEGER i [ ] hstmnt = DB_Statistics (hdbc, cat, sch, "", "1", "0") [ ] // retrieve name of table to which stats apply and whether ix is unique; // ignore the rest. [-] while (DB_FetchNext (hstmt, ignore, ignore, tab-name, i) == TRUE) { [ ] //print table names and index info ... [ ] }