odbc_statistics
odbc_statistics
Retrieve statistics about a table
**odbc_statistics** Odbc\Connection $odbc $catalog string $schema string $table int $unique int $accuracy
Get statistics about a table and its indexes.
odbc``catalogodbc.parameter.catalog
schemaodbc.parameter.schema
tableThe table name.
unique
The type of the index.
One of or .
SQL_INDEX_UNIQUE``SQL_INDEX_ALL
accuracy
One of or .
The latter requests that the driver retrieve the and
only if they are readily available from the server.
SQL_ENSURE``SQL_QUICK``CARDINALITY``PAGES
odbc.result.object-return-falseforfailure
The result set has the following columns:
odbc.result.driver-specific
-
TABLE_CAT -
TABLE_SCHEM -
TABLE_NAME -
NON_UNIQUE -
INDEX_QUALIFIER -
INDEX_NAME -
TYPE -
ORDINAL_POSITION -
COLUMN_NAME -
ASC_OR_DESC -
CARDINALITY -
PAGES -
FILTER_CONDITIONThe result set is ordered by , , , and .
NON_UNIQUE``TYPE``INDEX_QUALIFIER``INDEX_NAME``ORDINAL_POSITION
Voorbeeld: List Statistics of a Table
<?php
$conn = odbc_connect($dsn, $user, $pass);
$statistics = odbc_statistics($conn, 'TutorialDB', 'dbo', 'TEST', SQL_INDEX_UNIQUE, SQL_QUICK);
while (($row = odbc_fetch_array($statistics))) {
print_r($row);
break; // further rows omitted for brevity
}
?>
Array
(
[TABLE_CAT] => TutorialDB
[TABLE_SCHEM] => dbo
[TABLE_NAME] => TEST
[NON_UNIQUE] =>
[INDEX_QUALIFIER] =>
[INDEX_NAME] =>
[TYPE] => 0
[ORDINAL_POSITION] =>
[COLUMN_NAME] =>
[ASC_OR_DESC] =>
[CARDINALITY] => 15
[PAGES] => 3
[FILTER_CONDITION] =>
)
odbc_tables