📄 databasemetadata.h
字号:
* <code>"REFERENCES"</code> or a data source specific value * <li><b>IS_GRANTABLE</b> - string - <code>"YES"</code> if <code>GRANTEE</code> * can grant this privilege to other users. <code>"NO"</code> if not. * <code>NULL</code> if unknown. * </ol> */ ResultSet* getColumnPrivileges(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schema, const ODBCXX_STRING& table, const ODBCXX_STRING& columnNamePattern); /** Fetches a list of primary keys for a table. * * The returned ResultSet is ordered by * <code>TABLE_CAT</code>, <code>TABLE_SCHEM</code>, <code>TABLE_NAME</code> * and <code>KEY_SEQ</code>. It contains the following columns: * <ol> * <li><b>TABLE_CAT</b> - string - table catalog (can be <code>NULL</code>) * <li><b>TABLE_SCHEM</b> - string - table schema (can be <code>NULL</code>) * <li><b>TABLE_NAME</b> - string - table name * <li><b>COLUMN_NAME</b> - string - column name * <li><b>KEY_SEQ</b> - string - sequence number in primary key (1-based) * <li><b>PK_NAME</b> - string - primary key (constraint) name. * Can be <code>NULL</code>. * </ol> */ ResultSet* getPrimaryKeys(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schema, const ODBCXX_STRING& table); /** Fetches a list of indices and statistics for a table. * * The returned ResultSet is ordered by * <code>NON_UNIQUE</code>, <code>TYPE</code>, <code>INDEX_QUALIFIER</code>, * <code>INDEX_NAME</code> and <code>ORDINAL_POSITION</code>. * It contains the following columns: * <ol> * <li><b>TABLE_CAT</b> - string - table catalog (can be <code>NULL</code>) * <li><b>TABLE_SCHEM</b> - string - table schema (can be <code>NULL</code>) * <li><b>TABLE_NAME</b> - string - table name * <li><b>NON_UNIQUE</b> - bool - <code>true</code> if index values can * be non-unique. <code>NULL</code> if <code>TYPE</code> is * <code>tableIndexStatistic</code> * <li><b>INDEX_QUALIFIER</b> - string - index catalog, <code>NULL</code> * if <code>TYPE</code> is <code>tableIndexStatistic</code> * <li><b>INDEX_NAME</b> - string - index name, <code>NULL</code> * if <code>TYPE</code> is <code>tableIndexStatistic</code> * <li><b>TYPE</b> - short - index type: * <ul> * <li><code>tableIndexStatistic</code> - no real index - a statistic for the table * <li><code>tableIndexClustered</code> - this index is clustered * <li><code>tableIndexHashed</code> - this index is hashed * <li><code>tableIndexOther</code> - this is some other kind of index * </ul> * <li><b>ORDINAL_POSITION</b> - short - column sequence number in index (1-based). * <code>NULL</code> if <code>TYPE</code> is <code>tableIndexStatistic</code>. * <li><b>COLUMN_NAME</b> - string - column name. * <code>NULL</code> if <code>TYPE</code> is <code>tableIndexStatistic</code>. * <li><b>ASC_OR_DESC</b> - string - <code>"A"</code> for ascending, * <code>"D"</code> for descending index. <code>NULL</code> if <code>TYPE</code> * is <code>tableIndexStatistic</code>. * <li><b>CARDINALITY</b> - int - If <code>TYPE</code> is * <code>tableIndexStatistic</code>, the number of rows in the * table. Otherwise, the number of unique values in the index. * <li><b>PAGES</b> - int - Number of pages used for the table if * <code>TYPE</code> is <code>tableIndexStatistic</code>. Otherwise * the number of pages used for the index. * <li><b>FILTER_CONDITION</b> - string - filter condition (if any) * </ol> * @param catalog the catalog name * @param schema the schema name * @param table the table name * @param unique whether only unique indices should be looked at * @param approximate whether only accurate values should be retrieved */ ResultSet* getIndexInfo(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schema, const ODBCXX_STRING& table, bool unique, bool approximate); /** Figures out in which way a foreign key table references a * primary key table. Returns it's findings in a ResultSet, ordered * by <code>FKTABLE_CAT</code>, <code>FKTABLE_SCHEM</code>, * <code>FKTABLE_NAME</code> and <code>KEY_SEQ</code>. The * ResultSet contains the following columns: * <ol> * <li><b>PKTABLE_CAT</b> - string - primary key table catalog * <li><b>PKTABLE_SCHEM</b> - string - primary key table schema * <li><b>PKTABLE_NAME</b> - string - primary key table name * <li><b>PKCOLUMN_NAME</b> - string - primary key column name * <li><b>FKTABLE_CAT</b> - string - foreign key table catalog * <li><b>FKTABLE_SCHEM</b> - string - foreign key table schema * <li><b>FKTABLE_NAME</b> - string - foreign key table name * <li><b>FKCOLUMN_NAME</b> - string - foreign key column name * <li><b>KEY_SEQ</b> - short - column sequence number in key (1-based) * <li><b>UPDATE_RULE</b> - short - what happens to the foreign key * when the primary is updated: * <ul> * <li><code>importedKeyNoAction</code> - nothing happends since * the primary key can not be updated * <li><code>importedKeyCascade</code> - change imported key to * match the primary key * <li><code>importedKeySetNull</code> - update the imported key to * <code>NULL</code> * <li><code>importedKeySetDefault</code> - update the impored key to * it's default value * <li><code>importedKeyRestrict</code> - same as * <code>importedKeyNoAction</code> * </ul> * <li><b>DELETE_RULE</b> - short - what happens to the foreign key * when the primary is deleted: * <ul> * <li><code>importedKeyNoAction</code> - nothing happends since * the primary key can not be deleted * <li><code>importedKeyCascade</code> - imported key is deleted as well * <li><code>importedKeySetNull</code> - imported key is set * to <code>NULL</code> * <li><code>importedKeySetDefault</code> - imported key is set to it's * default value * <li><code>importedKeyRestrict</code> - same as * <code>importedKeyNoAction</code> * </ul> * </ol> */ ResultSet* getCrossReference(const ODBCXX_STRING& primaryCatalog, const ODBCXX_STRING& primarySchema, const ODBCXX_STRING& primaryTable, const ODBCXX_STRING& foreignCatalog, const ODBCXX_STRING& foreignSchema, const ODBCXX_STRING& foreignTable); /** Fetches a list of columns that are foreign keys to other tables' * primary keys. * * The returned ResultSet is identical to the one * returned by getCrossReference(), except it's ordered by * <code>PKTABLE_CAT</code>, <code>PKTABLE_SCHEM</code>, * <code>PKTABLE_NAME</code> and <code>KEY_SEQ</code>. */ ResultSet* getImportedKeys(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schema, const ODBCXX_STRING& table) { return this->getCrossReference(ODBCXX_STRING_CONST(""), ODBCXX_STRING_CONST(""), ODBCXX_STRING_CONST(""), catalog, schema, table); } /** Fetches a list of columns that reference a table's primary * keys. * * The returned ResultSet is identical to the one returned * by getCrossReference(). */ ResultSet* getExportedKeys(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schema, const ODBCXX_STRING& table) { return this->getCrossReference(catalog, schema, table, ODBCXX_STRING_CONST(""), ODBCXX_STRING_CONST(""), ODBCXX_STRING_CONST("")); } /** Returns available procedures in a catalog. * * The returned ResultSet is ordered by * <code>PROCEDURE_CAT</code>, <code>PROCEDURE_SCHEM</code> and * <code>PROCEDURE_NAME</code>. It contains the following columns: * <ol> * <li><b>PROCEDURE_CAT</b> - string - the procedure catalog * <li><b>PROCEDURE_SCHEM</b> - string - the procedure schema * <li><b>PROCEDURE_NAME</b> - string - the procedure name * <li><b>NUM_INPUT_PARAMS</b> - reserved for future use * <li><b>NUM_OUTPUT_PARAMS</b> - reserved for future use * <li><b>NUM_RESULT_SETS</b> - reserved for future use * <li><b>REMARKS</b> - string - comments on the procedure * <li><b>PROCEDURE_TYPE</b> - short - the procedure type: * <ul> * <li><code>procedureResultUnknown</code> - can possibly return * a result, but nobody is sure * <li><code>procedureNoResult</code> - does not return a result * <li><code>procedureReturnsResult</code> - returns a result * </ul> * </ol> */ ResultSet* getProcedures(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schemaPattern, const ODBCXX_STRING& procedureNamePattern); /** Returns available procedure columns in a catalog. * * The returned ResultSet is ordered by * <code>PROCEDURE_CAT</code>, <code>PROCEDURE_SCHEM</code>, * <code>PROCEDURE_NAME</code> and <code>COLUMN_NAME</code>. * It contains the following columns: * <ol> * <li><b>PROCEDURE_CAT</b> - string - the procedure catalog * <li><b>PROCEDURE_SCHEM</b> - string - the procedure schema * <li><b>PROCEDURE_NAME</b> - string - the procedure name * <li><b>COLUMN_NAME</b> - string - the column name * <li><b>COLUMN_TYPE</b> - short - the column type * <ul> * <li><code>procedureColumnUnknown</code> - beats the driver * <li><code>procedureColumnIn</code> - <code>IN</code> parameter * <li><code>procedureColumnInOut</code> - <code>IN OUT</code> parameter * <li><code>procedureColumnOut</code> - <code>OUT</code> parameter * <li><code>procedureColumnReturn</code> - procedure return value * (eg. this procedure is actually a function) * <li><code>procedureColumnResult</code> - this column is part of a * ResultSet this procedure returns * </ul> * <li><b>DATA_TYPE</b> - int - SQL type of the column * <li><b>TYPE_NAME</b> - string - native type name * <li><b>COLUMN_SIZE</b> - int - the precision of the column * <li><b>BUFFER_LENGTH</b> - int - nothing of interest * <li><b>DECIMAL_DIGITS</b> - short - scale, if applicable * <li><b>NUM_PREC_RADIX</b> - short - radix, if applicable * <li><b>NULLABLE</b> - short - whether the column is nullable * <ul> * <li><code>procedureNoNulls</code> - not nullable * <li><code>procedureNullable</code> - nullable * <li><code>procedureNullableUnknown</code> - nobody knows * </ul> * <li><b>REMARKS</b> - string - comments on the column * </ol> * * Note: more columns can be returned depending on the driver. */ ResultSet* getProcedureColumns(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schemaPattern, const ODBCXX_STRING& procedureNamePattern, const ODBCXX_STRING& columnNamePattern); /** Returns the optimal set of columns that identifies a row. * * The returned ResultSet is ordered by <code>SCOPE</code> and has * the following columns: * <ol> * <li><b>SCOPE</b> - short - scope of this result: * <ul> * <li><code>bestRowTemporary</code> - temporary, only while * a ResultSet is using the row * <li><code>bestRowTransaction</code> - valid until the * current transaction ends * <li><code>bestRowSession</code> - valid through the whole * session - until the connection is closed * </ul> * <li><b>COLUMN_NAME</b> - string - the column name * <li><b>DATA_TYPE</b> - short - the type of the column from Types * <li><b>TYPE_NAME</b> - string - native type name (data source dependent) * <li><b>COLUMN_SIZE</b> - int - the size (precision) of the column. * <li><b>BUFFER_LENGTH</b> - int - unused * <li><b>DECIMAL_DIGITS</b> - short - scale if applicable. * Can be <code>NULL</code>. * <li><b>PSEUDO_COLUMN</b> - short - whether this is a pseudo column: * <ul> * <li><code>bestRowUnknown</code> - it is unknown whether this is a pseudo * column * <li><code>bestRowNotPseudo</code> - it is definitely not a pseudo column * <li><code>bestRowPseudo</code> - it is definitely a pseudo column * </ul> * </ol> * @param catalog the catalog name * @param schema the schema name * @param table the table name * @param scope the scope of interest, same values as the <b>SCOPE</b> column. * @param nullable whether nullable columns should be included */ ResultSet* getBestRowIdentifier(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schema, const ODBCXX_STRING& table, int scope, bool nullable); /** Returns a list of columns for a table that are automatically updated * when anything in a row is updated. * * The returned ResultSet has the following unordered columns: * <ol> * <li><b>SCOPE</b> - short - unused * <li><b>COLUMN_NAME</b> - string - the column name * <li><b>DATA_TYPE</b> - short - the type of the column from Types * <li><b>TYPE_NAME</b> - string - native type name (data source dependent) * <li><b>COLUMN_SIZE</b> - int - the size (precision) of the column. * <li><b>BUFFER_LENGTH</b> - int - unused * <li><b>DECIMAL_DIGITS</b> - short - scale if applicable. * Can be <code>NULL</code>. * <li><b>PSEUDO_COLUMN</b> - short - whether this is a pseudo column: * <ul> * <li><code>versionColumnUnknown</code> - it is unknown whether this is a pseudo * column * <li><code>versionColumnNotPseudo</code> - it is definitely not a pseudo column * <li><code>versionColumnPseudo</code> - it is definitely a pseudo column * </ul> * </ol> */ ResultSet* getVersionColumns(const ODBCXX_STRING& catalog, const ODBCXX_STRING& schema, const ODBCXX_STRING& table); /** Fetches the table types the database supports. * * The returned ResultSet is the same as with getTables(), except * that all columns but <b>TABLE_TYPE</b> contain NULL values. */ ResultSet* getTableTypes(); /** Returns a list of available schemas in the database. * * The returned ResultSet is the same as with getTables(), except * that all columns but <b>TABLE_SCHEM</b> contain NULL values. */ ResultSet* getSchemas(); /** Returns a list of available catalogs in the database. * * The returned ResultSet is the same as with getTables(), except * that all columns but <b>TABLE_CAT</b> are NULL values. */ ResultSet* getCatalogs(); };} // namespace odbc#endif // __ODBCXX_DATABASEMETADATA_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -