Functions that return result sets of schema information on a database server. These result sets are specialized in ODBC.
Example of usage follows.
type OdbcTable = object catalog: array[256, char] table {.odbcCol: 3.}: array[256, char] ty {.odbcCol: 4.}: array[16, char] let conn = newConn(...) let stmt = conn.newStmt var row: OdbcTable stmt.bindCols row let rs = stmt.selectTables(...) while rs.next: # Do stuff with `row` here. It is updated for each `next` call.
This demonstrates usage of bindCols, which can be used in the same way for normal query situations also. odbcCol is used above to skip column 2 (indexed from 1) in the result set. This behavior is advised for specialization. The return columns is described in each relevant function in this module.
Types
IndexReserved = enum irEnsure, irQuick
- Source Edit
IndexUnique = enum iuUnique, iuAll
- Source Edit
SpecialColumnsIdentifierType = enum scitBestRowid, scitRowver
- Source Edit
SpecialColumnsNullable = enum scnNullable, scnNoNulls
- Source Edit
SpecialColumnsScope = enum scsCurrow, scsTransaction, scsSession
- Source Edit
TablesType = enum ttAll, ttTable = "TABLE", ttView = "VIEW", ttSysTable = "SYSTEM TABLE", ttGlobalTemp = "GLOBAL TEMPORARY", ttLocalTemp = "LOCAL TEMPORARY", ttAlias = "ALIAS", ttSynonym = "SYNONYM"
- Input to selectTables, and also return value of 4th column in selectTables. Source Edit
Consts
selectNone = ""
- Source Edit
Procs
proc selectColumnPrivileges(stmt: sink OdbcStmt; catalog, schema, table, column = selectNone): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Source Edit
proc selectColumns(stmt: sink OdbcStmt; catalog, schema, table, column = selectNone): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Source Edit
proc selectForeignKeys(stmt: sink OdbcStmt; pkCatalog, pkSchema, pkTable, fkCatalog, fkSchema, fkTable: string): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Patterns such as "%" are not allowed for any of the string arguments. Catalog and schema may be empty if they do not apply. Source Edit
proc selectIndexes(stmt: sink OdbcStmt; catalog, schema, table = selectNone; unique: IndexUnique = iuAll; reserved: IndexReserved = irQuick): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Source Edit
proc selectPrimaryKeys(stmt: sink OdbcStmt; catalog, schema, table: string): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Patterns such as "%" are not allowed for any of the string arguments. Catalog and schema may be empty if they do not apply. Source Edit
proc selectProcedureColumns(stmt: sink OdbcStmt; catalog, schema: string; procName, column = selectNone): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Patterns such as "%" are not allowed for catalog and schema. catalog and schema may be empty if they do not apply. Source Edit
proc selectProcedures(stmt: sink OdbcStmt; catalog, schema: string; procName = selectNone): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Patterns such as "%" are not allowed for catalog and schema. catalog and schema may be empty if they do not apply. Source Edit
proc selectSpecialColumns(stmt: sink OdbcStmt; catalog, schema, table: string; identifierType: SpecialColumnsIdentifierType; scope: SpecialColumnsScope; nullable: SpecialColumnsNullable): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Patterns such as "%" are not allowed for any of the string arguments. Catalog and schema may be empty if they do not apply. Source Edit
proc selectTablePrivileges(stmt: sink OdbcStmt; catalog, schema: string; table = selectAll): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Patterns such as "%" are not allowed for catalog and schema. catalog and schema may be empty if they do not apply. Source Edit
proc selectTables(stmt: sink OdbcStmt; catalog, schema, table = selectNone; tableType: set[TablesType] = {ttAll}): OdbcFastResultSet {. ...tags: [ReadIOEffect], raises: [OdbcException].}
- Source Edit