nanodbc
A small C++ wrapper for the native C ODBC API
Loading...
Searching...
No Matches
nanodbc::catalog Class Reference

A resource for get catalog information from connected data source. More...

#include <nanodbc.h>

Classes

class  columns
 Result set for a list of columns in one or more tables. More...
 
class  primary_keys
 Result set for a list of columns that compose the primary key of a single table. More...
 
class  procedure_columns
 Result set for a list of procedures in the data source. More...
 
class  procedures
 Result set for a list of procedures in the data source. More...
 
class  table_privileges
 Result set for a list of tables and the privileges associated with each table. More...
 
class  tables
 Result set for a list of tables in the data source. More...
 

Public Member Functions

 catalog (connection &conn) noexcept
 Creates catalog operating on database accessible through the specified connection.
 
catalog::tables find_tables (string const &table=string(), string const &type=string(), string const &schema=string(), string const &catalog=string())
 Creates result set with catalogs, schemas, tables, or table types.
 
catalog::table_privileges find_table_privileges (string const &catalog, string const &table=string(), string const &schema=string())
 Creates result set with tables and the privileges associated with each table.
 
catalog::columns find_columns (string const &column=string(), string const &table=string(), string const &schema=string(), string const &catalog=string())
 Creates result set with columns in one or more tables.
 
catalog::primary_keys find_primary_keys (string const &table, string const &schema=string(), string const &catalog=string())
 Creates result set with columns that compose the primary key of a single table.
 
catalog::procedures find_procedures (string const &procedure=string(), string const &schema=string(), string const &catalog=string())
 Creates result set with catalog, schema, procedure, and procedure types.
 
catalog::procedure_columns find_procedure_columns (string const &column=string(), string const &procedure=string(), string const &schema=string(), string const &catalog=string())
 Creates result set with columns in one or more procedures.
 
std::list< stringlist_catalogs ()
 Returns names of all catalogs (or databases) available in connected data source.
 
std::list< stringlist_schemas ()
 Returns names of all schemas available in connected data source.
 
std::list< stringlist_table_types ()
 Returns all available table types in the connected data source.
 

Detailed Description

A resource for get catalog information from connected data source.

Queries are performed using the Catalog Functions in ODBC. All provided operations are convenient wrappers around the ODBC API The original ODBC behaviour should not be affected by any added processing.

Member Function Documentation

◆ find_tables()

catalog::tables nanodbc::catalog::find_tables ( string const &  table = string(),
string const &  type = string(),
string const &  schema = string(),
string const &  catalog = string() 
)

Creates result set with catalogs, schemas, tables, or table types.

Tables information is obtained by executing SQLTable function within scope of the connected database accessible with the specified connection. Since this function is implemented in terms of the SQLTables, it returns result set ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM, and TABLE_NAME.

All arguments are treated as the Pattern Value Arguments. Empty string argument is equivalent to passing the search pattern ''.

◆ find_table_privileges()

catalog::table_privileges nanodbc::catalog::find_table_privileges ( string const &  catalog,
string const &  table = string(),
string const &  schema = string() 
)

Creates result set with tables and the privileges associated with each table.

Tables information is obtained by executing SQLTablePrivileges function within scope of the connected database accessible with the specified connection. Since this function is implemented in terms of the SQLTablePrivilegess, it returns result set ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, PRIVILEGE, and GRANTEE.

Parameters
catalogThe table catalog. It cannot contain a string search pattern.
schemaString search pattern for schema names, treated as the Pattern Value Arguments.
tableString search pattern for table names, treated as the Pattern Value Arguments.
Note
Due to the fact catalog cannot is not the Pattern Value Argument, order of parameters is different than in the other catalog look-up functions.

◆ find_columns()

catalog::columns nanodbc::catalog::find_columns ( string const &  column = string(),
string const &  table = string(),
string const &  schema = string(),
string const &  catalog = string() 
)

Creates result set with columns in one or more tables.

Columns information is obtained by executing SQLColumns function within scope of the connected database accessible with the specified connection. Since this function is implemented in terms of the SQLColumns, it returns result set ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and ORDINAL_POSITION.

All arguments are treated as the Pattern Value Arguments. Empty string argument is equivalent to passing the search pattern ''.

◆ find_primary_keys()

catalog::primary_keys nanodbc::catalog::find_primary_keys ( string const &  table,
string const &  schema = string(),
string const &  catalog = string() 
)

Creates result set with columns that compose the primary key of a single table.

Returns result set with column names that make up the primary key for a table. The primary key information is obtained by executing SQLPrimaryKey function within scope of the connected database accessible with the specified connection.

All arguments are treated as the Pattern Value Arguments. Empty string argument is equivalent to passing the search pattern ''.

◆ find_procedures()

catalog::procedures nanodbc::catalog::find_procedures ( string const &  procedure = string(),
string const &  schema = string(),
string const &  catalog = string() 
)

Creates result set with catalog, schema, procedure, and procedure types.

Procedure information is obtained by executing SQLProcedures function within scope of the connected database accessible with the specified connection. Since this function is implemented in terms of the SQLProceduress, it returns result set ordered by PROCEDURE_CAT, PROCEDUORE_SCHEM, and PROCEDURE_NAME.

All arguments are treated as the Pattern Value Arguments. Empty string argument is equivalent to passing the search pattern ''.

◆ find_procedure_columns()

catalog::procedure_columns nanodbc::catalog::find_procedure_columns ( string const &  column = string(),
string const &  procedure = string(),
string const &  schema = string(),
string const &  catalog = string() 
)

Creates result set with columns in one or more procedures.

Columns information is obtained by executing SQLProcedureColumns function within scope of the connected database accessible with the specified connection. Since this function is implemented in terms of the SQLProcedureColumns, it returns result set ordered by PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME, and COLUMN_TYPE.

All arguments are treated as the Pattern Value Arguments. Empty string argument is equivalent to passing the search pattern ''.

◆ list_catalogs()

std::list< string > nanodbc::catalog::list_catalogs ( )

Returns names of all catalogs (or databases) available in connected data source.

Executes SQLTables function with SQL_ALL_CATALOG as catalog search pattern.

◆ list_schemas()

std::list< string > nanodbc::catalog::list_schemas ( )

Returns names of all schemas available in connected data source.

Executes SQLTables function with SQL_ALL_SCHEMAS as schema search pattern.

◆ list_table_types()

std::list< string > nanodbc::catalog::list_table_types ( )

Returns all available table types in the connected data source.

Executes SQLTables function with SQL_ALL_TABLE_TYPES as the table type search pattern.


The documentation for this class was generated from the following file: