version 6.5
OC GET TABLE STAT (cursor_ID; tableTarget; tableQualifier; tableOwner; tableName; nonUnique; indexQualifier; indexName; type; seqInIndex; colName; collation; cardinality; pages; filterCondition)
| Parameter | Type | Description | |
| cursor_ID | Longint | Connection Identifier | |
| tableTarget | String | Name of the target table | |
| tableQualifier | String | Name of 4D array | |
| tableOwner | String | Name of 4D array | |
| tableName | String | Name of 4D array | |
| nonUnique | String | Name of 4D array | |
| indexQualifier | String | Name of 4D array | |
| indexName | String | Name of 4D array | |
| type | String | Name of 4D array | |
| seqInIndex | String | Name of 4D array | |
| colName | String | Name of 4D array | |
| collation | String | Name of 4D array | |
| cardinality | String | Name of 4D array | |
| pages | String | Name of 4D array | |
| filterCondition | String | Name of 4D array |
Description
The OC GET TABLE STAT command returns a list of statistics about a single table and the indexes associated with it.
cursor_ID must be a valid cursor.
tableTarget is the name of the target table of the data source.
tableQualifier is the table qualifier of the table to which the statistic or index applies. You can receive an empty string if not applicable to the data source.
tableOwner is the table owner identifier of the table to which the statistic or index applies. You can receive an empty string if not applicable to the data source.
tableName is the table identifier of the table to which the statistic or index applies.
nonUnique indicates whether the index prohibits duplicated values.
indexQualifier is the identifier used to qualify the index name that is doing a DROP INDEX. An empty string is returned if an index qualifier is not supported by the data source or if type is SQL_TABLE_STAT. If a non-null value is returned, it must be used to qualify the index name on a DROP INDEX statement, otherwise the tableOwner name should be used to qualify the index name.
indexName is the identifier used to qualify the index name. An empty string is returned if type is SQL_TABLE_STAT.
type is the type of information being returned :
| 0 -> SQL_TABLE_STAT that indicates a statistic for the table. | |
| 1 -> SQL_INDEX_CLUSTERED that indicates a clustered index. | |
| 2 -> SQL_INDEX_HASHED that indicates a hashed index. | |
| 3 -> SQL_INDEX_OTHER that indicates another type of index. |
seqInIndex is the column sequence number in the index starting with 1. An empty string is returned if type is SQL_TABLE_STAT.
colName is the column identifier. An empty string is returned if type is SQL_TABLE_STAT.
collation sorts the sequence for a column: 'A' for ascending, 'D' for descending. An empty string is returned if type is SQL_TABLE_STAT or if the column sort sequence is not supported.
cardinality is the number of rows in the table if type is SQL_TABLE_STAT; otherwise it is the number of unique values in the index. An empty string is returned if the value is not available from the data source.
pages is the number of pages used to store the table (if type is SQL_TABLE_STAT) or the index (if type is not SQL_TABLE_STAT). An empty string is returned if the value is not available from the data source or if not applicable to the data source.
filterCondition: if the index is a filtered index, this is the filter condition, such as SALARY > 300. If the filter condition cannot be determined, it returns an empty string.
Example
`Declare the needed arrays
ARRAY STRING(15;aTableQualifier;0)
ARRAY STRING(15;aTableOwner;0)
ARRAY STRING(15;aTableName;0)
ARRAY STRING(15;aNonUnique;0)
ARRAY STRING(15;aIndexQualifier;0)
ARRAY STRING(15;aIndexName;0)
ARRAY STRING(15;aType;0)
ARRAY STRING(15;aSeqInIndex;0)
ARRAY STRING(15;aColName;0)
ARRAY STRING(15;aCollation;0)
ARRAY STRING(15;aCardinality;0)
ARRAY STRING(15;aPages;0)
ARRAY STRING(15;aFilterCondition;0)
loginID:=OC Login ("sa";"";"MSSQL65")
cursor:=OC Create cursor (loginID)
OC GET TABLE STAT (cursor;"employee";"aTableQualifier";"aTableOwner";"aTableName";"aNonUnique";
"aIndexQualifier";"aIndexName";"aType";"aSeqInIndex";"aColName";
"aCollation";"aCardinality";"aPages";"aFilterCondition")
OC DROP CURSOR (cursor)
OC LOGOUT (loginID)