Previous Page TOC Index Next Page



SQLGetFunctions (ODBC 1.0, Level 1)

SQLGetFunctions returns information about whether a driver supports a specific ODBC function. This function is implemented in the Driver Manager; it can also be implemented in drivers. If a driver implements SQLGetFunctions, the Driver Manager calls the function in the driver. Otherwise, it executes the function itself.

Syntax

RETCODE SQLGetFunctions(hdbc, fFunction, pfExists)

The SQLGetFunctions function accepts the following arguments:

Type

Argument

Use

Description

HDBC

hdbc

Input

Connection handle.

UWORD

fFunction

Input

SQL_API_ALL_FUNCTIONS or a #define value that identifies the ODBC function of interest. For a list of #define values that identify ODBC functions, see the tables in "Comments."

UWORD FAR *

pfExists

Output

If fFunction is SQL_API_ALL_FUNCTIONS, pfExists points to a UWORD array with 100 elements. The array is indexed by #define values used by fFunction to identify each ODBC function; some elements of the array are unused and reserved for future use. An element is TRUE if it identifies an ODBC function supported by the driver. It is FALSE if it identifies an ODBC function not supported by the driver or does not identify an ODBC function.

Note The fFunction value SQL_API_ALL_FUNCTIONS was added in ODBC 2.0.

If fFunction identifies a single ODBC function, pfExists points to single UWORD. pfExists is TRUE if the specified function is supported by the driver; otherwise, it is FALSE.

Returns

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

Diagnostics

When SQLGetFunctions returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLError. The following table lists the SQLSTATE values commonly returned by SQLGetFunctions and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

SQLSTATE

Error

Description

01000

General warning

Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)

S1000

General error

An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLError in the argument szErrorMsg describes the error and its cause.

S1001

Memory allocation failure

The driver was unable to allocate memory required to support execution or completion of the function.

S1010

Function sequence error

(DM) SQLGetFunctions was called before SQLConnect, SQLBrowseConnect, or SQLDriverConnect.

(DM) SQLBrowseConnect was called for the hdbc and returned SQL_NEED_DATA. This function was called before SQLBrowseConnect returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.

S1095

Function type out of range

(DM) An invalid fFunction value was specified.

Comments

SQLGetFunctions always returns that SQLGetFunctions, SQLDataSources, and SQLDrivers are supported. It does this because these functions are implemented in the Driver Manager.

The following table lists valid values for fFunction for ODBC core functions.

SQL_API_SQLALLOCCONNECT

SQL_API_SQLFETCH

SQL_API_SQLALLOCSTMT

SQL_API_SQLFREEENV

SQL_API_SQLBINDCOL

SQL_API_SQLFREESTMT

SQL_API_SQLCANCEL

SQL_API_SQLGETCURSORNAME

SQL_API_SQLCOLATTRIBUTES

SQL_API_SQLNUMRESULTCOLS

SQL_API_SQLCONNECT

SQL_API_SQLPREPARE

SQL_API_SQLDESCRIBECOL

SQL_API_SQLROWCOUNT

SQL_API_SQLDISCONNECT

SQL_API_SQLSETCURSORNAME

SQL_API_SQLERROR

SQL_API_SQLSETPARAM

SQL_API_SQLEXECDIRECT

SQL_API_SQLTRANSACT

SQL_API_SQLEXECUTE



Note For ODBC 1.0 drivers, SQLGetFunctions returns TRUE in pfExists if fFunction is SQL_API_SQLBINDPARAMETER or SQL_API_SQLSETPARAM and the driver supports SQLSetParam. For ODBC 2.0 drivers, SQLGetFunctions returns TRUE in pfExists if fFunction is SQL_API_SQLSETPARAM or SQL_API_SQLBINDPARAMETER and the driver supports SQLBindParameter.

The following table lists valid values for fFunction for ODBC extension level 1 functions.

SQL_API_SQLBINDPARAMETER

SQL_API_SQLGETTYPEINFO

SQL_API_SQLDRIVERCONNECT

SQL_API_SQLPUTDATA

SQL_API_
SQLGETCONNECTOPTION

SQL_API_
SQLSETCONNECTOPTION

SQL_API_SQLGETDATA

SQL_API_SQLSETSTMTOPTION

SQL_API_SQLGETFUNCTIONS

SQL_API_SQLSPECIALCOLUMNS

SQL_API_SQLGETINFO

SQL_API_SQLSTATISTICS

SQL_API_SQLGETSTMTOPTION

SQL_API_SQLTABLES

The following table lists valid values for fFunction for ODBC extension level 2 functions.

SQL_API_SQLBROWSECONNECT

SQL_API_SQLNUMPARAMS

SQL_API_SQLDATASOURCES

SQL_API_SQLPRIMARYKEYS

SQL_API_SQLDESCRIBEPARAM

SQL_API_SQLPROCEDURECOLUMNS

SQL_API_SQLDRIVERS

SQL_API_SQLPROCEDURES

SQL_API_SQLEXTENDEDFETCH

SQL_API_SQLSETPOS

SQL_API_SQLFOREIGNKEYS

SQL_API_SQLSETSCROLLOPTIONS

SQL_API_SQLMORERESULTS

SQL_API_SQLTABLEPRIVILEGES

SQL_API_SQLNATIVESQL


Code Example

The following two examples show how an application uses SQLGetFunctions to determine if a driver supports SQLTables, SQLColumns, and SQLStatistics. If the driver does not support these functions, the application disconnects from the driver. The first example calls SQLGetFunctions once for each function.

UWORD TablesExists, ColumnsExists, StatisticsExists;
SQLGetFunctions(hdbc, SQL_API_SQLTABLES, &TablesExists);
SQLGetFunctions(hdbc, SQL_API_SQLCOLUMNS, &ColumnsExists);
SQLGetFunctions(hdbc, SQL_API_SQLSTATISTICS, &StatisticsExists);
if (TablesExists && ColumnsExists && StatisticsExists) {
   /* Continue with application */
}
SQLDisconnect(hdbc);

The second example calls SQLGetFunctions a single time and passes it an array in which SQLGetFunctions returns information about all ODBC functions.

UWORD fExists[100];
SQLGetFunctions(hdbc, SQL_API_ALL_FUNCTIONS, fExists);
if (fExists[SQL_API_SQLTABLES] &&

fExists[SQL_API_SQLCOLUMNS] &&
fExists[SQL_API_SQLSTATISTICS]) { /* Continue with application */ } SQLDisconnect(hdbc);

Related Functions

For information about

See

Returning the setting of a connection option

SQLGetConnectOption (extension)

Returning information about a driver or data source

SQLGetInfo (extension)

Returning the setting of a statement option

SQLGetStmtOption (extension)

SQLGetInfo (ODBC 1.0, Level 1)

SQLGetInfo returns general information about the driver and data source associated with an hdbc.

Syntax

RETCODE SQLGetInfo(hdbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue)

The SQLGetInfo function accepts the following arguments.

Type

Argument

Use

Description

HDBC

hdbc

Input

Connection handle.

UWORD

fInfoType

Input

Type of information. fInfoType must be a value representing the type of interest (see "Comments").

PTR

rgbInfoValue

Output

Pointer to storage for the information. Depending on the fInfoType requested, the information returned will be one of the following: a null-terminated character string, a 16-bit integer value, a 32-bit flag, or a 32-bit binary value.

SWORD

cbInfoValueMax

Input

Maximum length of the rgbInfoValue buffer.

SWORD FAR *

pcbInfoValue

Output

The total number of bytes (excluding the null termination byte for character data) available to return in rgbInfoValue.

For character data, if the number of bytes available to return is greater than or equal to cbInfoValueMax, the information in rgbInfoValue is truncated to cbInfoValueMax – 1 bytes and is null-terminated by the driver.

For all other types of data, the value of cbValueMax is ignored and the driver assumes the size of rgbValue is 32 bits.

Returns

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

Diagnostics

When SQLGetInfo returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLError. The following table lists the SQLSTATE values commonly returned by SQLGetInfo and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

SQLSTATE

Error

Description

01000

General warning

Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)

01004

Data truncated

The buffer rgbInfoValue was not large enough to return all of the requested information, so the information was truncated. The argument pcbInfoValue contains the length of the requested information in its untruncated form. (Function returns SQL_SUCCESS_WITH_INFO.)

08003

Connection not open

(DM) The type of information requested in fInfoType requires an open connection. Of the information types reserved by ODBC, only SQL_ODBC_VER can be returned without an open connection.

22003

Numeric value out of range

Returning the requested information would have caused a loss of numeric or binary significance.

IM001

Driver does not support this function

(DM) The driver corresponding to the hdbc does not support the function.

S1000

General error

An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLError in the argument szErrorMsg describes the error and its cause.

S1001

Memory allocation failure

The driver was unable to allocate memory required to support execution or completion of the function.

S1009

Invalid argument value

(DM) The fInfoType was SQL_DRIVER_HSTMT, and the value pointed to by rgbInfoValue was not a valid statement handle.

S1090

Invalid string or buffer length

(DM) The value specified for argument cbInfoValueMax was less than 0.

S1096

Information type out of range

(DM) The value specified for the argument fOption was in the block of numbers reserved for ODBC information types, but was not valid for the version of ODBC supported by the driver.

S1C00

Driver not capable

The value specified for the argument fOption was in the range of numbers reserved for driver-specific information types, but was not supported by the driver.

S1T00

Timeout expired

The timeout period expired before the data source returned the requested information. The timeout period is set through SQLSetStmtOption, SQL_QUERY_TIMEOUT.

Comments

The currently defined information types are shown below; it is expected that more will be defined to take advantage of different data sources. Information types from 0 to 999 are reserved by ODBC; driver developers must reserve values greater than or equal to SQL_INFO_DRIVER_START for driver-specific use.

The format of the information returned in rgbInfoValue depends on the fInfoType requested. SQLGetInfo will return information in one of five different formats:

The format of each of the following information types is noted in the type’s description. The application must cast the value returned in rgbInfoValue accordingly. For an example of how an application could retrieve data from a 32-bit bitmask, see "Code Example."

A driver must return a value for each of the information types defined in the following tables. If an information type does not apply to the driver or data source, then the driver returns one of the following values:

Format of rgbInfoValue

Returned value

Character string ("Y" or "N")

"N"

Character string (not "Y" or "N")

Empty string

16-bit integer

0

32-bit bitmask or 32-bit binary value

0L

For example, if a data source does not support procedures, SQLGetInfo returns the following values for the values of fInfoType that are related to procedures:

fInfoType

Returned value

SQL_PROCEDURES

"N"

SQL_ACCESSIBLE_PROCEDURES

"N"

SQL_MAX_PROCEDURE_NAME_LEN

0

SQL_PROCEDURE_TERM

Empty string

SQLGetInfo returns SQLSTATE S1096 (Invalid argument value) for values of fInfoType that are in the range of information types reserved for use by ODBC but are not defined by the version of ODBC supported by the driver. To determine what version of ODBC a driver conforms to, an application calls SQLGetInfo with the SQL_DRIVER_ODBC_VER information type. SQLGetInfo returns SQLSTATE S1C00 (Driver not capable) for values of fInfoType that are in the range of information types reserved for driver-specific use but are not supported by the driver.


Note Application developers should be aware that ODBC 1.0 drivers might return SQL_ERROR and SQLSTATE S1C00 (Driver not capable) for values of fInfoType that were defined in ODBC 1.0 but do not apply to the driver or the data source.

Information Types

This section lists the information types supported by SQLGetInfo. Information types are grouped categorically and listed alphabetically.

Driver Information

The following values of fInfoType return information about the ODBC driver, such as the number of active statements, the data source name, and the API conformance levels.

SQL_ACTIVE_CONNECTIONS

SQL_ACTIVE_STATEMENTS

SQL_DATA_SOURCE_NAME

SQL_DRIVER_HDBC

SQL_DRIVER_HENV

SQL_DRIVER_HLIB

SQL_DRIVER_HSTMT

SQL_DRIVER_NAME

SQL_DRIVER_ODBC_VER

SQL_DRIVER_VER

SQL_FETCH_DIRECTION

SQL_FILE_USAGE

SQL_GETDATA_EXTENSIONS

SQL_LOCK_TYPES

SQL_ODBC_API_CONFORMANCE

SQL_ODBC_SAG_CLI_CONFORMANCE

SQL_ODBC_VER

SQL_POS_OPERATIONS

SQL_ROW_UPDATES

SQL_SEARCH_PATTERN_ESCAPE

SQL_SERVER_NAME

DBMS Product Information

The following values of fInfoType return information about the DBMS product, such as the DBMS name and version.

SQL_DATABASE_NAME

SQL_DBMS_NAME

SQL_DBMS_VER

Data Source Information

The following values of fInfoType return information about the data source, such as cursor characteristics and transaction capabilities.

SQL_ACCESSIBLE_PROCEDURES

SQL_ACCESSIBLE_TABLES

SQL_BOOKMARK_PERSISTENCE

SQL_CONCAT_NULL_BEHAVIOR

SQL_CURSOR_COMMIT_BEHAVIOR

SQL_CURSOR_ROLLBACK_BEHAVIOR

SQL_DATA_SOURCE_READ_ONLY

SQL_DEFAULT_TXN_ISOLATION

SQL_MULT_RESULT_SETS

SQL_MULTIPLE_ACTIVE_TXN

SQL_NEED_LONG_DATA_LEN

SQL_NULL_COLLATION

SQL_OWNER_TERM

SQL_PROCEDURE_TERM

SQL_QUALIFIER_TERM

SQL_SCROLL_CONCURRENCY

SQL_SCROLL_OPTIONS

SQL_STATIC_SENSITIVITY

SQL_TABLE_TERM

SQL_TXN_CAPABLE

SQL_TXN_ISOLATION_OPTION

SQL_USER_NAME

Supported SQL

The following values of fInfoType return information about the SQL statements supported by the data source. These information types do not exhaustively describe the entire ODBC SQL grammar. Instead, they describe those parts of the grammar for which data sources commonly offer different levels of support.

Applications should determine the general level of supported grammar from the SQL_ODBC_SQL_CONFORMANCE information type and use the other information types to determine variations from the stated conformance level.

SQL_ALTER_TABLE

SQL_COLUMN_ALIAS

SQL_CORRELATION_NAME

SQL_EXPRESSIONS_IN_ORDERBY

SQL_GROUP_BY

SQL_IDENTIFIER_CASE

SQL_IDENTIFIER_QUOTE_CHAR

SQL_KEYWORDS

SQL_LIKE_ESCAPE_CLAUSE

SQL_NON_NULLABLE_COLUMNS

SQL_ODBC_SQL_CONFORMANCE

SQL_ODBC_SQL_OPT_IEF

SQL_ORDER_BY_COLUMNS_IN_SELECT

SQL_OUTER_JOINS

SQL_OWNER_USAGE

SQL_POSITIONED_STATEMENTS

SQL_PROCEDURES

SQL_QUALIFIER_LOCATION

SQL_QUALIFIER_NAME_SEPARATOR

SQL_QUALIFIER_USAGE

SQL_QUOTED_IDENTIFIER_CASE

SQL_SPECIAL_CHARACTERS

SQL_SUBQUERIES

SQL_UNION

SQL Limits

The following values of fInfoType return information about the limits applied to identifiers and clauses in SQL statements, such as the maximum lengths of identifiers and the maximum number of columns in a select list. Limitations may be imposed by either the driver or the data source.

SQL_MAX_BINARY_LITERAL_LEN

SQL_MAX_CHAR_LITERAL_LEN

SQL_MAX_COLUMN_NAME_LEN

SQL_MAX_COLUMNS_IN_GROUP_BY

SQL_MAX_COLUMNS_IN_ORDER_BY

SQL_MAX_COLUMNS_IN_INDEX

SQL_MAX_COLUMNS_IN_SELECT

SQL_MAX_COLUMNS_IN_TABLE

SQL_MAX_CURSOR_NAME_LEN

SQL_MAX_INDEX_SIZE

SQL_MAX_OWNER_NAME_LEN

SQL_MAX_PROCEDURE_NAME_LEN

SQL_MAX_QUALIFIER_NAME_LEN

SQL_MAX_ROW_SIZE

SQL_MAX_ROW_SIZE_INCLUDES_LONG

SQL_MAX_STATEMENT_LEN

SQL_MAX_TABLE_NAME_LEN

SQL_MAX_TABLES_IN_SELECT

SQL_MAX_USER_NAME_LEN

Scalar Function Information

The following values of fInfoType return information about the scalar functions supported by the data source and the driver. For more information about scalar functions, see Appendix F, "Scalar Functions."

SQL_CONVERT_FUNCTIONS

SQL_NUMERIC_FUNCTIONS

SQL_STRING_FUNCTIONS

SQL_SYSTEM_FUNCTIONS

SQL_TIMEDATE_ADD_INTERVALS

SQL_TIMEDATE_DIFF_INTERVALS

SQL_TIMEDATE_FUNCTIONS

Conversion Information

The following values of fInfoType return a list of the SQL data types to which the data source can convert the specified SQL data type with the CONVERT scalar function.

SQL_CONVERT_BIGINT

SQL_CONVERT_BINARY

SQL_CONVERT_BIT

SQL_CONVERT_CHAR

SQL_CONVERT_DATE

SQL_CONVERT_DECIMAL

SQL_CONVERT_DOUBLE

SQL_CONVERT_FLOAT

SQL_CONVERT_INTEGER

SQL_CONVERT_LONGVARBINARY

SQL_CONVERT_LONGVARCHAR

SQL_CONVERT_NUMERIC

SQL_CONVERT_REAL

SQL_CONVERT_SMALLINT

SQL_CONVERT_TIME

SQL_CONVERT_TIMESTAMP

SQL_CONVERT_TINYINT

SQL_CONVERT_VARBINARY

SQL_CONVERT_VARCHAR

Information Type Descriptions

The following table alphabetically lists each information type, the version of ODBC in which it was introduced, and its description.

InfoType

Returns

SQL_ACCESSIBLE_
PROCEDURES
(ODBC 1.0)

A character string: "Y" if the user can execute all procedures returned by SQLProcedures, "N" if there may be procedures returned that the user cannot execute.

SQL_ACCESSIBLE_TABLES
(ODBC 1.0)

A character string: "Y" if the user is guaranteed SELECT privileges to all tables returned by SQLTables, "N" if there may be tables returned that the user cannot access.

SQL_ACTIVE_
CONNECTIONS
(ODBC 1.0)

A 16-bit integer value specifying the maximum number of active hdbcs that the driver can support. This value can reflect a limitation imposed by either the driver or the data source. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_ACTIVE_STATEMENTS
(ODBC 1.0)

A 16-bit integer value specifying the maximum number of active hstmts that the driver can support for an hdbc. This value can reflect a limitation imposed by either the driver or the data source. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_ALTER_TABLE
(ODBC 2.0)

A 32-bit bitmask enumerating the clauses in the ALTER TABLE statement supported by the data source.

The following bitmask is used to determine which clauses are supported:

SQL_AT_ADD_COLUMN
SQL_AT_DROP_COLUMN

SQL_BOOKMARK_
PERSISTENCE
(ODBC 2.0)

A 32-bit bitmask enumerating the operations through which bookmarks persist.

The following bitmasks are used in conjunction with the flag to determine through which options bookmarks persist:

SQL_BP_CLOSE = Bookmarks are valid after an application calls SQLFreeStmt with the SQL_CLOSE option to close the cursor associated with an hstmt.

SQL_BP_DELETE = The bookmark for a row is valid after that row has been deleted.

SQL_BP_DROP = Bookmarks are valid after an hstmt an application calls SQLFreeStmt with the SQL_DROP option to drop an hstmt.

SQL_BP_SCROLL = Bookmarks are valid after any scrolling operation (call to SQLExtendedFetch). Because all bookmarks must remain valid after SQLExtendedFetch is called, this value can be used by applications to determine whether bookmarks are supported.

SQL_BP_TRANSACTION = Bookmarks are valid after an application commits or rolls back a transaction.

SQL_BP_UPDATE = The bookmark for a row is valid after any column in that row has been updated, including key columns.

SQL_BP_OTHER_HSTMT = A bookmark associated with one hstmt can be used with another hstmt.

SQL_COLUMN_ALIAS
(ODBC 2.0)

A character string: "Y" if the data source supports column aliases; otherwise, "N".

SQL_CONCAT_NULL_
BEHAVIOR
(ODBC 1.0)

A 16-bit integer value indicating how the data source handles the concatenation of NULL valued character data type columns with non-NULL valued character data type columns:

SQL_CB_NULL = Result is NULL valued.

SQL_CB_NON_NULL = Result is concatenation of non-NULL valued column or columns.

SQL_CONVERT_BIGINT
SQL_CONVERT_BINARY
SQL_CONVERT_BIT
SQL_CONVERT_CHAR
SQL_CONVERT_DATE
SQL_CONVERT_DECIMAL
SQL_CONVERT_DOUBLE
SQL_CONVERT_FLOAT
SQL_CONVERT_INTEGER
SQL_CONVERT_
LONGVARBINARY
SQL_CONVERT_
LONGVARCHAR
SQL_CONVERT_NUMERIC
SQL_CONVERT_REAL
SQL_CONVERT_SMALLINT
SQL_CONVERT_TIME
SQL_CONVERT_
TIMESTAMP
SQL_CONVERT_TINYINT
SQL_CONVERT_
VARBINARY
SQL_CONVERT_VARCHAR
(ODBC 1.0)

A 32-bit bitmask. The bitmask indicates the conversions supported by the data source with the CONVERT scalar function for data of the type named in the fInfoType. If the bitmask equals zero, the data source does not support any conversions for data of the named type, including conversion to the same data type.

For example, to find out if a data source supports the conversion of SQL_INTEGER data to the SQL_BIGINT data type, an application calls SQLGetInfo with the fInfoType of SQL_CONVERT_INTEGER. The application ANDs the returned bitmask with SQL_CVT_BIGINT. If the resulting value is nonzero, the conversion is supported.

The following bitmasks are used to determine which conversions are supported:

SQL_CVT_BIGINT
SQL_CVT_BINARY
SQL_CVT_BIT
SQL_CVT_CHAR
SQL_CVT_DATE
SQL_CVT_DECIMAL
SQL_CVT_DOUBLE
SQL_CVT_FLOAT
SQL_CVT_INTEGER
SQL_CVT_LONGVARBINARY
SQL_CVT_LONGVARCHAR
SQL_CVT_NUMERIC
SQL_CVT_REAL
SQL_CVT_SMALLINT
SQL_CVT_TIME
SQL_CVT_TIMESTAMP
SQL_CVT_TINYINT
SQL_CVT_VARBINARY
SQL_CVT_VARCHAR

SQL_CONVERT_
FUNCTIONS
(ODBC 1.0)

A 32-bit bitmask enumerating the scalar conversion functions supported by the driver and associated data source.

The following bitmask is used to determine which conversion functions are supported:

SQL_FN_CVT_CONVERT

SQL_CORRELATION_NAME
(ODBC 1.0)

A 16-bit integer indicating if table correlation names are supported:

SQL_CN_NONE = Correlation names are not supported.

SQL_CN_DIFFERENT = Correlation names are supported, but must differ from the names of the tables they represent.

SQL_CN_ANY = Correlation names are supported and can be any valid user-defined name.

SQL_CURSOR_COMMIT_
BEHAVIOR
(ODBC 1.0)

A 16-bit integer value indicating how a COMMIT operation affects cursors and prepared statements in the data source:

SQL_CB_DELETE = Close cursors and delete prepared statements. To use the cursor again, the application must reprepare and reexecute the hstmt.

SQL_CB_CLOSE = Close cursors. For prepared statements, the application can call SQLExecute on the hstmt without calling SQLPrepare again.

SQL_CB_PRESERVE = Preserve cursors in the same position as before the COMMIT operation. The application can continue to fetch data or it can close the cursor and reexecute the hstmt without repreparing it.

SQL_CURSOR_ROLLBACK_
BEHAVIOR
(ODBC 1.0)

A 16-bit integer value indicating how a ROLLBACK operation affects cursors and prepared statements in the data source:

SQL_CB_DELETE = Close cursors and delete prepared statements. To use the cursor again, the application must reprepare and reexecute the hstmt.

SQL_CB_CLOSE = Close cursors. For prepared statements, the application can call SQLExecute on the hstmt without calling SQLPrepare again.

SQL_CB_PRESERVE = Preserve cursors in the same position as before the ROLLBACK operation. The application can continue to fetch data or it can close the cursor and reexecute the hstmt without repreparing it.

SQL_DATA_SOURCE_NAME
(ODBC 1.0)

A character string with the data source name used during connection. If the application called SQLConnect, this is the value of the szDSN argument. If the application called SQLDriverConnect or SQLBrowseConnect, this is the value of the DSN keyword in the connection string passed to the driver. If the connection string did not contain the DSN keyword (such as when it contains the DRIVER keyword), this is an empty string.

SQL_DATA_SOURCE_
READ_ONLY
(ODBC 1.0)

A character string. "Y" if the data source is set to READ ONLY mode, "N" if it is otherwise.

This characteristic pertains only to the data source itself, it is not a characteristic of the driver that enables access to the data source.

SQL_DATABASE_NAME
(ODBC 1.0)

A character string with the name of the current database in use, if the data source defines a named object called "database."

Note In ODBC 2.0, this value of fInfoType has been replaced by the SQL_CURRENT_QUALIFIER connection option. ODBC 2.0 drivers should continue to support the SQL_DATABASE_NAME information type, and ODBC 2.0 applications should only use it with ODBC 1.0 drivers.

SQL_DBMS_NAME
(ODBC 1.0)

A character string with the name of the DBMS product accessed by the driver.

SQL_DBMS_VER
(ODBC 1.0)

A character string indicating the version of the DBMS product accessed by the driver. The version is of the form ##.##.####, where the first two digits are the major version, the next two digits are the minor version, and the last four digits are the release version. The driver must render the DBMS product version in this form, but can also append the DBMS product-specific version as well. For example, "04.01.0000 Rdb 4.1".

SQL_DEFAULT_TXN_
ISOLATION
(ODBC 1.0)

A 32-bit integer that indicates the default transaction isolation level supported by the driver or data source, or zero if the data source does not support transactions. The following terms are used to define transaction isolation levels:

Dirty Read Transaction 1 changes a row. Transaction 2 reads the changed row before transaction 1 commits the change. If transaction 1 rolls back the change, transaction 2 will have read a row that is considered to have never existed.

Nonrepeatable Read Transaction 1 reads a row. Transaction 2 updates or deletes that row and commits this change. If transaction 1 attempts to reread the row, it will receive different row values or discover that the row has been deleted.

Phantom Transaction 1 reads a set of rows that satisfy some search criteria. Transaction 2 inserts a row that matches the search criteria. If transaction 1 reexecutes the statement that read the rows, it receives a different set of rows.

If the data source supports transactions, the driver returns one of the following bitmasks:

SQL_TXN_READ_UNCOMMITTED = Dirty reads, nonrepeatable reads, and phantoms are possible.

SQL_TXN_READ_COMMITTED = Dirty reads are not possible. Nonrepeatable reads and phantoms are possible.

SQL_TXN_REPEATABLE_READ = Dirty reads and nonrepeatable reads are not possible. Phantoms are possible.

SQL_TXN_SERIALIZABLE = Transactions are serializable. Dirty reads, nonrepeatable reads, and phantoms are not possible.

SQL_TXN_VERSIONING = Transactions are serializable, but higher concurrency is possible than with SQL_TXN_SERIALIZABLE. Dirty reads are not possible. Typically, SQL_TXN_SERIALIZABLE is implemented by using locking protocols that reduce concurrency and SQL_TXN_VERSIONING is implemented by using a non-locking protocol such as record versioning. Oracle’s Read Consistency isolation level is an example of SQL_TXN_VERSIONING.

SQL_DRIVER_HDBC
SQL_DRIVER_HENV
(ODBC 1.0)

A 32-bit value, the driver’s environment handle or connection handle, determined by the argument hdbc.

These information types are implemented by the Driver Manager alone.

SQL_DRIVER_HLIB
(ODBC 2.0)

A 32-bit value, the library handle returned to the Driver Manager when it loaded the driver DLL. The handle is only valid for the hdbc specified in the call to SQLGetInfo.

This information type is implemented by the Driver Manager alone.

SQL_DRIVER_HSTMT
(ODBC 1.0)

A 32-bit value, the driver’s statement handle determined by the Driver Manager statement handle, which must be passed on input in rgbInfoValue from the application. Note that in this case, rgbInfoValue is both an input and an output argument. The input hstmt passed in rgbInfoValue must have been an hstmt allocated on the argument hdbc.

This information type is implemented by the Driver Manager alone.

SQL_DRIVER_NAME
(ODBC 1.0)

A character string with the filename of the driver used to access the data source.

SQL_DRIVER_ODBC_VER
(ODBC 2.0)

A character string with the version of ODBC that the driver supports. The version is of the form ##.##, where the first two digits are the major version and the next two digits are the minor version. SQL_SPEC_MAJOR and SQL_SPEC_MINOR define the major and minor version numbers. For the version of ODBC described in this manual, these are 2 and 0, and the driver should return "02.00".

If a driver supports SQLGetInfo but does not support this value of the fInfoType argument, the Driver Manager returns "01.00".

SQL_DRIVER_VER
(ODBC 1.0)

A character string with the version of the driver and, optionally a description of the driver. At a minimum, the version is of the form ##.##.####, where the first two digits are the major version, the next two digits are the minor version, and the last four digits are the release version.

SQL_EXPRESSIONS_IN_
ORDERBY
(ODBC 1.0)

A character string: "Y" if the data source supports expressions in the ORDER BY list; "N" if it does not.

SQL_FETCH_DIRECTION
(ODBC 1.0)

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

A 32-bit bitmask enumerating the supported fetch direction options.

The following bitmasks are used in conjunction with the flag to determine which options are supported:

SQL_FD_FETCH_NEXT (ODBC 1.0)
SQL_FD_FETCH_FIRST (ODBC 1.0)
SQL_FD_FETCH_LAST (ODBC 1.0)
SQL_FD_FETCH_PRIOR (ODBC 1.0)
SQL_FD_FETCH_ABSOLUTE (ODBC 1.0)
SQL_FD_FETCH_RELATIVE (ODBC 1.0)
SQL_FD_FETCH_RESUME (ODBC 1.0)
SQL_FD_FETCH_BOOKMARK (ODBC 2.0)

SQL_FILE_USAGE
(ODBC 2.0)

A 16-bit integer value indicating how a single-tier driver directly treats files in a data source:

SQL_FILE_NOT_SUPPORTED = The driver is not a single-tier driver. For example, an ORACLE driver is a two-tier driver.

SQL_FILE_TABLE = A single-tier driver treats files in a data source as tables. For example, an Xbase driver treats each Xbase file as a table.

SQL_FILE_QUALIFIER = A single-tier driver treats files in a data source as a qualifier. For example, a Microsoft Access driver treats each Microsoft Access file as a complete database.

An application might use this to determine how users will select data. For example, Xbase users often think of data as stored in files, while ORACLE and Microsoft Access users generally think of data as stored in tables.

When a user selects an Xbase data source, the application could display the Windows File Open common dialog box; when the user selects a Microsoft Access or ORACLE data source, the application could display a custom Select Table dialog box.

SQL_GETDATA_
EXTENSIONS
(ODBC 2.0)

A 32-bit bitmask enumerating extensions to SQLGetData.

The following bitmasks are used in conjunction with the flag to determine what common extensions the driver supports for SQLGetData:

SQL_GD_ANY_COLUMN = SQLGetData can be called for any unbound column, including those before the last bound column. Note that the columns must be called in order of ascending column number unless SQL_GD_ANY_ORDER is also returned.

SQL_GD_ANY_ORDER = SQLGetData can be called for unbound columns in any order. Note that SQLGetData can only be called for columns after the last bound column unless SQL_GD_ANY_COLUMN is also returned.

SQL_GD_BLOCK = SQLGetData can be called for an unbound column in any row in a block (more than one row) of data after positioning to that row with SQLSetPos.

SQL_GD_BOUND = SQLGetData can be called for bound columns as well as unbound columns. A driver cannot return this value unless it also returns SQL_GD_ANY_COLUMN.

SQLGetData is only required to return data from unbound columns that occur after the last bound column, are called in order of increasing column number, and are not in a row in a block of rows.

SQL_GROUP_BY
(ODBC 2.0)

A 16-bit integer value specifying the relationship between the columns in the GROUP BY clause and the non-aggregated columns in the select list:

SQL_GB_NOT_SUPPORTED = GROUP BY clauses are not supported.

SQL_GB_GROUP_BY_EQUALS_SELECT = The GROUP BY clause must contain all non-aggregated columns in the select list. It cannot contain any other columns. For example, SELECT DEPT, MAX(SALARY) FROM EMPLOYEE GROUP BY DEPT.

SQL_GB_GROUP_BY_CONTAINS_SELECT = The GROUP BY clause must contain all non-aggregated columns in the select list. It can contain columns that are not in the select list. For example, SELECT DEPT, MAX(SALARY) FROM EMPLOYEE GROUP BY DEPT, AGE.

SQL_GB_NO_RELATION = The columns in the GROUP BY clause and the select list are not related. The meaning of non-grouped, non-aggregated columns in the select list is data source–dependent. For example, SELECT DEPT, SALARY FROM EMPLOYEE GROUP BY DEPT, AGE.

SQL_IDENTIFIER_CASE
(ODBC 1.0)

A 16-bit integer value as follows:

SQL_IC_UPPER = Identifiers in SQL are case insensitive and are stored in upper case in system catalog.

SQL_IC_LOWER = Identifiers in SQL are case insensitive and are stored in lower case in system catalog.

SQL_IC_SENSITIVE = Identifiers in SQL are case sensitive and are stored in mixed case in system catalog.

SQL_IC_MIXED = Identifiers in SQL are case insensitive and are stored in mixed case in system catalog.

SQL_IDENTIFIER_QUOTE_
CHAR
(ODBC 1.0)

The character string used as the starting and ending delimiter of a quoted (delimited) identifiers in SQL statements. (Identifiers passed as arguments to ODBC functions do not need to be quoted.) If the data source does not support quoted identifiers, a blank is returned.

SQL_KEYWORDS
(ODBC 2.0)

A character string containing a comma-separated list of all data source–specific keywords. This list does not contain keywords specific to ODBC or keywords used by both the data source and ODBC.

For a list of ODBC keywords, see "List of Reserved Keywords" in Appendix C, "SQL Grammar." The #define value SQL_ODBC_KEYWORDS contains a comma-separated list of ODBC keywords.

SQL_LIKE_ESCAPE_CLAUSE
(ODBC 2.0)

A character string: "Y" if the data source supports an escape character for the percent character (%) and underscore character (_) in a LIKE predicate and the driver supports the ODBC syntax for defining a LIKE predicate escape character; "N" otherwise.

SQL_LOCK_TYPES
(ODBC 2.0)

A 32-bit bitmask enumerating the supported lock types for the fLock argument in SQLSetPos.

The following bitmasks are used in conjunction with the flag to determine which lock types are supported:

SQL_LCK_NO_CHANGE
SQL_LCK_EXCLUSIVE
SQL_LCK_UNLOCK

SQL_MAX_BINARY_
LITERAL_LEN
(ODBC 2.0)

A 32-bit integer value specifying the maximum length (number of hexadecimal characters, excluding the literal prefix and suffix returned by SQLGetTypeInfo) of a binary literal in an SQL statement. For example, the binary literal 0xFFAA has a length of 4. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_CHAR_LITERAL_LEN
(ODBC 2.0)

A 32-bit integer value specifying the maximum length (number of characters, excluding the literal prefix and suffix returned by SQLGetTypeInfo) of a character literal in an SQL statement. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_COLUMN_
NAME_LEN
(ODBC 1.0)

A 16-bit integer value specifying the maximum length of a column name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_COLUMNS_IN_
GROUP_BY
(ODBC 2.0)

A 16-bit integer value specifying the maximum number of columns allowed in a GROUP BY clause. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_COLUMNS_IN_
INDEX
(ODBC 2.0)

A 16-bit integer value specifying the maximum number of columns allowed in an index. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_COLUMNS_IN_
ORDER_BY
(ODBC 2.0)

A 16-bit integer value specifying the maximum number of columns allowed in an ORDER BY clause. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_COLUMNS_IN_
SELECT
(ODBC 2.0)

A 16-bit integer value specifying the maximum number of columns allowed in a select list. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_COLUMNS_IN_
TABLE
(ODBC 2.0)

A 16-bit integer value specifying the maximum number of columns allowed in a table. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_CURSOR_NAME_LEN
(ODBC 1.0)

A 16-bit integer value specifying the maximum length of a cursor name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_INDEX_SIZE
(ODBC 2.0)

A 32-bit integer value specifying the maximum number of bytes allowed in the combined fields of an index. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_OWNER_NAME_LEN
(ODBC 1.0)

A 16-bit integer value specifying the maximum length of an owner name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_PROCEDURE_
NAME_LEN
(ODBC 1.0)

A 16-bit integer value specifying the maximum length of a procedure name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_QUALIFIER_
NAME_LEN
(ODBC 1.0)

A 16-bit integer value specifying the maximum length of a qualifier name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_ROW_SIZE
(ODBC 2.0)

A 32-bit integer value specifying the maximum length of a single row in a table. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_ROW_SIZE_
INCLUDES_
LONG
(ODBC 2.0)

A character string: "Y" if the maximum row size returned for the SQL_MAX_ROW_SIZE information type includes the length of all SQL_LONGVARCHAR and SQL_LONGVARBINARY columns in the row; "N" otherwise.

SQL_MAX_STATEMENT_
LEN
(ODBC 2.0)

A 32-bit integer value specifying the maximum length (number of characters, including white space) of an SQL statement. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_TABLE_NAME_
LEN
(ODBC 1.0)

A 16-bit integer value specifying the maximum length of a table name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MAX_TABLES_IN_
SELECT
(ODBC 2.0)

A 16-bit integer value specifying the maximum number of tables allowed in the FROM clause of a SELECT statement. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_MAX_USER_NAME_
LEN
(ODBC 2.0)

A 16-bit integer value specifying the maximum length of a user name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.

SQL_MULT_RESULT_SETS
(ODBC 1.0)

A character string: "Y" if the data source supports multiple result sets, "N" if it does not.

SQL_MULTIPLE_ACTIVE_
TXN
(ODBC 1.0)

A character string: "Y" if active transactions on multiple connections are allowed, "N" if only one connection at a time can have an active transaction.

SQL_NEED_LONG_DATA_
LEN
(ODBC 2.0)

A character string: "Y" if the data source needs the length of a long data value (the data type is SQL_LONGVARCHAR, SQL_LONGVARBINARY, or a long, data source–specific data type) before that value is sent to the data source, "N" if it does not. For more information, see SQLBindParameter and SQLSetPos.

SQL_NON_NULLABLE_
COLUMNS
(ODBC 1.0)

A 16-bit integer specifying whether the data source supports non-nullable columns:

SQL_NNC_NULL = All columns must be nullable.

SQL_NNC_NON_NULL = Columns may be non-nullable (the data source supports the NOT NULL column constraint in CREATE TABLE statements).

SQL_NULL_COLLATION
(ODBC 2.0)

A 16-bit integer value specifying where NULLs are sorted in a list:

SQL_NC_END = NULLs are sorted at the end of the list, regardless of the sort order.

SQL_NC_HIGH = NULLs are sorted at the high end of the list.

SQL_NC_LOW = NULLs are sorted at the low end of the list.

SQL_NC_START = NULLs are sorted at the start of the list, regardless of the sort order.

SQL_NUMERIC_
FUNCTIONS
(ODBC 1.0)

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

A 32-bit bitmask enumerating the scalar numeric functions supported by the driver and associated data source.

The following bitmasks are used to determine which numeric functions are supported:

SQL_FN_NUM_ABS (ODBC 1.0)
SQL_FN_NUM_ACOS (ODBC 1.0)
SQL_FN_NUM_ASIN (ODBC 1.0)
SQL_FN_NUM_ATAN (ODBC 1.0)
SQL_FN_NUM_ATAN2 (ODBC 1.0)
SQL_FN_NUM_CEILING (ODBC 1.0)
SQL_FN_NUM_COS (ODBC 1.0)
SQL_FN_NUM_COT (ODBC 1.0)
SQL_FN_NUM_DEGREES (ODBC 2.0)
SQL_FN_NUM_EXP (ODBC 1.0)
SQL_FN_NUM_FLOOR (ODBC 1.0)
SQL_FN_NUM_LOG (ODBC 1.0)
SQL_FN_NUM_LOG10 (ODBC 2.0)
SQL_FN_NUM_MOD (ODBC 1.0)
SQL_FN_NUM_PI (ODBC 1.0)
SQL_FN_NUM_POWER (ODBC 2.0)
SQL_FN_NUM_RADIANS (ODBC 2.0)
SQL_FN_NUM_RAND (ODBC 1.0)
SQL_FN_NUM_ROUND (ODBC 2.0)
SQL_FN_NUM_SIGN (ODBC 1.0)
SQL_FN_NUM_SIN (ODBC 1.0)
SQL_FN_NUM_SQRT (ODBC 1.0)
SQL_FN_NUM_TAN (ODBC 1.0)
SQL_FN_NUM_TRUNCATE (ODBC 2.0)

SQL_ODBC_API_
CONFORMANCE
(ODBC 1.0)

A 16-bit integer value indicating the level of ODBC conformance:

SQL_OAC_NONE = None

SQL_OAC_LEVEL1 = Level 1 supported

SQL_OAC_LEVEL2 = Level 2 supported

(For a list of functions and conformance levels, see Chapter 11, "Function Summary.")

SQL_ODBC_SAG_CLI_
CONFORMANCE
(ODBC 1.0)

A 16-bit integer value indicating compliance to the functions of the SAG specification:

SQL_OSCC_NOT_COMPLIANT = Not SAG-compliant; one or more core functions are not supported

SQL_OSCC_COMPLIANT = SAG-compliant

SQL_ODBC_SQL_
CONFORMANCE
(ODBC 1.0)

A 16-bit integer value indicating SQL grammar supported by the driver:

SQL_OSC_MINIMUM = Minimum grammar supported

SQL_OSC_CORE = Core grammar supported

SQL_OSC_EXTENDED = Extended grammar supported

SQL_ODBC_SQL_OPT_IEF
(ODBC 1.0)

A character string: "Y" if the data source supports the optional Integrity Enhancement Facility; "N" if it does not.

SQL_ODBC_VER
(ODBC 1.0)

A character string with the version of ODBC to which the Driver Manager conforms. The version is of the form ##.##, where the first two digits are the major version and the next two digits are the minor version. This is implemented solely in the Driver Manager.

SQL_ORDER_BY_
COLUMNS_IN_SELECT
(ODBC 2.0)

A character string: "Y" if the columns in the ORDER BY clause must be in the select list; otherwise, "N".

SQL_OUTER_JOINS
(ODBC 1.0)

The information type was introduced in ODBC 1.0; each return value is labeled with the version in which it was introduced.

A character string:

"N" = No. The data source does not support outer joins. (ODBC 1.0)

"Y" = Yes. The data source supports two-table outer joins, and the driver supports the ODBC outer join syntax except for nested outer joins. However, columns on the left side of the comparison operator in the ON clause must come from the left-hand table in the outer join, and columns on the right side of the comparison operator must come from the right-hand table. (ODBC 1.0)

"P" = Partial. The data source partially supports nested outer joins, and the driver supports the ODBC outer join syntax. However, columns on the left side of the comparison operator in the ON clause must come from the left-hand table in the outer join and columns on the right side of the comparison operator must come from the right-hand table. Also, the right-hand table of an outer join cannot be included in an inner join. (ODBC 2.0)

"F" = Full. The data source fully supports nested outer joins, and the driver supports the ODBC outer join syntax. (ODBC 2.0)

SQL_OWNER_TERM
(ODBC 1.0)

A character string with the data source vendor’s name for an owner; for example, "owner", "Authorization ID", or "Schema".

SQL_OWNER_USAGE
(ODBC 2.0)

A 32-bit bitmask enumerating the statements in which owners can be used:

SQL_OU_DML_STATEMENTS = Owners are supported in all Data Manipulation Language statements: SELECT, INSERT, UPDATE, DELETE, and, if supported, SELECT FOR UPDATE and positioned update and delete statements.

SQL_OU_PROCEDURE_INVOCATION = Owners are supported in the ODBC procedure invocation statement.

SQL_OU_TABLE_DEFINITION = Owners are supported in all table definition statements: CREATE TABLE, CREATE VIEW, ALTER TABLE, DROP TABLE, and DROP VIEW.

SQL_OU_INDEX_DEFINITION = Owners are supported in all index definition statements: CREATE INDEX and DROP INDEX.

SQL_OU_PRIVILEGE_DEFINITION = Owners are supported in all privilege definition statements: GRANT and REVOKE.

SQL_POS_OPERATIONS
(ODBC 2.0)

A 32-bit bitmask enumerating the supported operations in SQLSetPos.

The following bitmasks are used to in conjunction with the flag to determine which options are supported:

SQL_POS_POSITION
SQL_POS_REFRESH
SQL_POS_UPDATE
SQL_POS_DELETE
SQL_POS_ADD

SQL_POSITIONED_
STATEMENTS
(ODBC 2.0)

A 32-bit bitmask enumerating the supported positioned SQL statements.

The following bitmasks are used to determine which statements are supported:

SQL_PS_POSITIONED_DELETE
SQL_PS_POSITIONED_UPDATE
SQL_PS_SELECT_FOR_UPDATE

SQL_PROCEDURE_TERM
(ODBC 1.0)

A character string with the data source vendor’s name for a procedure; for example, "database procedure", "stored procedure", or "procedure".

SQL_PROCEDURES
(ODBC 1.0)

A character string: "Y" if the data source supports procedures and the driver supports the ODBC procedure invocation syntax; "N" otherwise.

SQL_QUALIFIER_
LOCATION
(ODBC 2.0)

A 16-bit integer value indicating the position of the qualifier in a qualified table name:

SQL_QL_START
SQL_QL_END

For example, an Xbase driver returns SQL_QL_START because the directory (qualifier) name is at the start of the table name, as in \EMPDATA\EMP.DBF. An ORACLE Server driver returns SQL_QL_END, because the qualifier is at the end of the table name, as in ADMIN.EMP@EMPDATA.

SQL_QUALIFIER_NAME_
SEPARATOR
(ODBC 1.0)

A character string: the character or characters that the data source defines as the separator between a qualifier name and the qualified name element that follows it.

SQL_QUALIFIER_TERM
(ODBC 1.0)

A character string with the data source vendor’s name for a qualifier; for example, "database" or "directory".

SQL_QUALIFIER_USAGE
(ODBC 2.0)

A 32-bit bitmask enumerating the statements in which qualifiers can be used.

The following bitmasks are used to determine where qualifiers can be used:

SQL_QU_DML_STATEMENTS = Qualifiers are supported in all Data Manipulation Language statements: SELECT, INSERT, UPDATE, DELETE, and, if supported, SELECT FOR UPDATE and positioned update and delete statements.

SQL_QU_PROCEDURE_INVOCATION = Qualifiers are supported in the ODBC procedure invocation statement.

SQL_QU_TABLE_DEFINITION = Qualifiers are supported in all table definition statements: CREATE TABLE, CREATE VIEW, ALTER TABLE, DROP TABLE, and DROP VIEW.

SQL_QU_INDEX_DEFINITION = Qualifiers are supported in all index definition statements: CREATE INDEX and DROP INDEX.

SQL_QU_PRIVILEGE_DEFINITION = Qualifiers are supported in all privilege definition statements: GRANT and REVOKE.

SQL_QUOTED_
IDENTIFIER_CASE
(ODBC 2.0)

A 16-bit integer value as follows:

SQL_IC_UPPER = Quoted identifiers in SQL are case insensitive and are stored in upper case in system catalog.

SQL_IC_LOWER = Quoted identifiers in SQL are case insensitive and are stored in lower case in system catalog.

SQL_IC_SENSITIVE = Quoted identifiers in SQL are case sensitive and are stored in mixed case in system catalog.

SQL_IC_MIXED = Quoted identifiers in SQL are case insensitive and are stored in mixed case in system catalog.

SQL_ROW_UPDATES
(ODBC 1.0)

A character string: "Y" if a keyset-driven or mixed cursor maintains row versions or values for all fetched rows and therefore can detect any changes made to a row by any user since the row was last fetched; otherwise, "N".

SQL_SCROLL_
CONCURRENCY
(ODBC 1.0)

A 32-bit bitmask enumerating the concurrency control options supported for scrollable cursors.

The following bitmasks are used to determine which options are supported:

SQL_SCCO_READ_ONLY = Cursor is read only. No updates are allowed.

SQL_SCCO_LOCK = Cursor uses the lowest level of locking sufficient to ensure that the row can be updated.

SQL_SCCO_OPT_ROWVER = Cursor uses optimistic concurrency control, comparing row versions, such as SQLBase® ROWID or Sybase TIMESTAMP.

SQL_SCCO_OPT_VALUES = Cursor uses optimistic concurrency control, comparing values.

For information about cursor concurrency, see "Specifying Cursor Concurrency" in Chapter 7, "Retrieving Results."

SQL_SCROLL_OPTIONS
(ODBC 1.0)

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

A 32-bit bitmask enumerating the scroll options supported for scrollable cursors.

The following bitmasks are used to determine which options are supported:

SQL_SO_FORWARD_ONLY = The cursor only scrolls forward. (ODBC 1.0)

SQL_SO_STATIC = The data in the result set is static. (ODBC 2.0)

SQL_SO_KEYSET_DRIVEN = The driver saves and uses the keys for every row in the result set. (ODBC 1.0)

SQL_SO_DYNAMIC = The driver keeps the keys for every row in the rowset (the keyset size is the same as the rowset size). (ODBC 1.0)

SQL_SO_MIXED = The driver keeps the keys for every row in the keyset, and the keyset size is greater than the rowset size. The cursor is keyset-driven inside the keyset and dynamic outside the keyset. (ODBC 1.0)

For information about scrollable cursors, see "Scrollable Cursors" in Chapter 7, "Retrieving Results."

SQL_SEARCH_PATTERN_
ESCAPE
(ODBC 1.0)

A character string specifying what the driver supports as an escape character that permits the use of the pattern match metacharacters underscore (_) and percent (%) as valid characters in search patterns. This escape character applies only for those catalog function arguments that support search strings. If this string is empty, the driver does not support a search-pattern escape character.

This fInfoType is limited to catalog functions. For a description of the use of the escape character in search pattern strings, see "Search Pattern Arguments" earlier in this chapter.

SQL_SERVER_NAME
(ODBC 1.0)

A character string with the actual data source–specific server name; useful when a data source name is used during SQLConnect, SQLDriverConnect, and SQLBrowseConnect.

SQL_SPECIAL_
CHARACTERS
(ODBC 2.0)

A character string containing all special characters (that is, all characters except a through z, A through Z, 0 through 9, and underscore) that can be used in an object name, such as a table, column, or index name, on the data source. For example, "#$^".

SQL_STATIC_SENSITIVITY
(ODBC 2.0)

A 32-bit bitmask enumerating whether changes made by an application to a static or keyset-driven cursor through SQLSetPos or positioned update or delete statements can be detected by that application:

SQL_SS_ADDITIONS = Added rows are visible to the cursor; the cursor can scroll to these rows. Where these rows are added to the cursor is driver-dependent.

SQL_SS_DELETIONS = Deleted rows are no longer available to the cursor and do not leave a "hole" in the result set; after the cursor scrolls from a deleted row, it cannot return to that row.

SQL_SS_UPDATES = Updates to rows are visible to the cursor; if the cursor scrolls from and returns to an updated row, the data returned by the cursor is the updated data, not the original data. Because updating key values in a keyset-driven cursor is considered to be deleting the existing row and adding a new row, this value is always returned for keyset-driven cursors.

Whether an application can detect changes made to the result set by other users, including other cursors in the same application, depends on the cursor type. For more information, see "Scrollable Cursors" in Chapter 7, "Retrieving Results."

SQL_STRING_FUNCTIONS
(ODBC 1.0)

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

A 32-bit bitmask enumerating the scalar string functions supported by the driver and associated data source.

The following bitmasks are used to determine which string functions are supported:

SQL_FN_STR_ASCII (ODBC 1.0)
SQL_FN_STR_CHAR (ODBC 1.0)
SQL_FN_STR_CONCAT (ODBC 1.0)
SQL_FN_STR_DIFFERENCE (ODBC 2.0)
SQL_FN_STR_INSERT (ODBC 1.0)
SQL_FN_STR_LCASE (ODBC 1.0)
SQL_FN_STR_LEFT (ODBC 1.0)
SQL_FN_STR_LENGTH (ODBC 1.0)
SQL_FN_STR_LOCATE (ODBC 1.0)
SQL_FN_STR_LOCATE_2 (ODBC 2.0)
SQL_FN_STR_LTRIM (ODBC 1.0)
SQL_FN_STR_REPEAT (ODBC 1.0)
SQL_FN_STR_REPLACE (ODBC 1.0)
SQL_FN_STR_RIGHT (ODBC 1.0)
SQL_FN_STR_RTRIM (ODBC 1.0)
SQL_FN_STR_SOUNDEX (ODBC 2.0)
SQL_FN_STR_SPACE (ODBC 2.0)
SQL_FN_STR_SUBSTRING (ODBC 1.0)
SQL_FN_STR_UCASE (ODBC 1.0)

If an application can call the LOCATE scalar function with the string_exp1, string_exp2, and start arguments, the driver returns the SQL_FN_STR_LOCATE bitmask. If an application can call the LOCATE scalar function with only the string_exp1 and string_exp2 arguments, the driver returns the SQL_FN_STR_LOCATE_2 bitmask. Drivers that fully support the LOCATE scalar function return both bitmasks.

SQL_SUBQUERIES
(ODBC 2.0)

A 32-bit bitmask enumerating the predicates that support subqueries:

SQL_SQ_CORRELATED_SUBQUERIES
SQL_SQ_COMPARISON
SQL_SQ_EXISTS
SQL_SQ_IN
SQL_SQ_QUANTIFIED

The SQL_SQ_CORRELATED_SUBQUERIES bitmask indicates that all predicates that support subqueries support correlated subqueries.

SQL_SYSTEM_FUNCTIONS
(ODBC 1.0)

A 32-bit bitmask enumerating the scalar system functions supported by the driver and associated data source.

The following bitmasks are used to determine which system functions are supported:

SQL_FN_SYS_DBNAME
SQL_FN_SYS_IFNULL
SQL_FN_SYS_USERNAME

SQL_TABLE_TERM
(ODBC 1.0)

A character string with the data source vendor’s name for a table; for example, "table" or "file".

SQL_TIMEDATE_ADD_
INTERVALS
(ODBC 2.0)

A 32-bit bitmask enumerating the timestamp intervals supported by the driver and associated data source for the TIMESTAMPADD scalar function.

The following bitmasks are used to determine which intervals are supported:

SQL_FN_TSI_FRAC_SECOND
SQL_FN_TSI_SECOND
SQL_FN_TSI_MINUTE
SQL_FN_TSI_HOUR
SQL_FN_TSI_DAY
SQL_FN_TSI_WEEK
SQL_FN_TSI_MONTH
SQL_FN_TSI_QUARTER
SQL_FN_TSI_YEAR

SQL_TIMEDATE_DIFF_
INTERVALS
(ODBC 2.0)

A 32-bit bitmask enumerating the timestamp intervals supported by the driver and associated data source for the TIMESTAMPDIFF scalar function.

The following bitmasks are used to determine which intervals are supported:

SQL_FN_TSI_FRAC_SECOND
SQL_FN_TSI_SECOND
SQL_FN_TSI_MINUTE
SQL_FN_TSI_HOUR
SQL_FN_TSI_DAY
SQL_FN_TSI_WEEK
SQL_FN_TSI_MONTH
SQL_FN_TSI_QUARTER
SQL_FN_TSI_YEAR

SQL_TIMEDATE_
FUNCTIONS
(ODBC 1.0)

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

A 32-bit bitmask enumerating the scalar date and time functions supported by the driver and associated data source.

The following bitmasks are used to determine which date and time functions are supported:

SQL_FN_TD_CURDATE (ODBC 1.0)
SQL_FN_TD_CURTIME (ODBC 1.0)
SQL_FN_TD_DAYNAME (ODBC 2.0)
SQL_FN_TD_DAYOFMONTH (ODBC 1.0)
SQL_FN_TD_DAYOFWEEK (ODBC 1.0)
SQL_FN_TD_DAYOFYEAR (ODBC 1.0)
SQL_FN_TD_HOUR (ODBC 1.0)
SQL_FN_TD_MINUTE (ODBC 1.0)
SQL_FN_TD_MONTH (ODBC 1.0)
SQL_FN_TD_MONTHNAME (ODBC 2.0)
SQL_FN_TD_NOW (ODBC 1.0)
SQL_FN_TD_QUARTER (ODBC 1.0)
SQL_FN_TD_SECOND (ODBC 1.0)
SQL_FN_TD_TIMESTAMPADD (ODBC 2.0)
SQL_FN_TD_TIMESTAMPDIFF (ODBC 2.0)
SQL_FN_TD_WEEK (ODBC 1.0)
SQL_FN_TD_YEAR (ODBC 1.0)

SQL_TXN_CAPABLE
(ODBC 1.0)

The information type was introduced in ODBC 1.0; each return value is labeled with the version in which it was introduced

A 16-bit integer value describing the transaction support in the driver or data source:

SQL_TC_NONE = Transactions not supported. (ODBC 1.0)

SQL_TC_DML = Transactions can only contain Data Manipulation Language (DML) statements (SELECT, INSERT, UPDATE, DELETE). Data Definition Language (DDL) statements encountered in a transaction cause an error. (ODBC 1.0)

SQL_TC_DDL_COMMIT = Transactions can only contain DML statements. DDL statements (CREATE TABLE, DROP INDEX, an so on) encountered in a transaction cause the transaction to be committed. (ODBC 2.0)

SQL_TC_DDL_IGNORE = Transactions can only contain DML statements. DDL statements encountered in a transaction are ignored. (ODBC 2.0)

SQL_TC_ALL = Transactions can contain DDL statements and DML statements in any order. (ODBC 1.0)

SQL_TXN_ISOLATION_

OPTION
(ODBC 1.0)

A 32-bit bitmask enumerating the transaction isolation levels available from the driver or data source. The following bitmasks are used in conjunction with the flag to determine which options are supported:

SQL_TXN_READ_UNCOMMITTED
SQL_TXN_READ_COMMITTED
SQL_TXN_REPEATABLE_READ
SQL_TXN_SERIALIZABLE
SQL_TXN_VERSIONING

For descriptions of these isolation levels, see the description of SQL_DEFAULT_TXN_ISOLATION.

SQL_UNION
(ODBC 2.0)

A 32-bit bitmask enumerating the support for the UNION clause:

SQL_U_UNION = The data source supports the UNION clause.

SQL_U_UNION_ALL = The data source supports the ALL keyword in the UNION clause. (SQLGetInfo returns both SQL_U_UNION and SQL_U_UNION_ALL in this case.)

SQL_USER_NAME
(ODBC 1.0)

A character string with the name used in a particular database, which can be different than login name.

Code Example

SQLGetInfo returns lists of supported options as a 32-bit bitmask in rgbInfoValue. The bitmask for each option is used in conjunction with the flag to determine whether the option is supported.

For example, an application could use the following code to determine whether the SUBSTRING scalar function is supported by the driver associated with the hdbc:

UDWORD    fFuncs;
SQLGetInfo(hdbc,

SQL_STRING_FUNCTIONS,
(PTR)&fFuncs,
sizeof(fFuncs),
NULL); if (fFuncs & SQL_FN_STR_SUBSTRING) /* SUBSTRING supported */
...;
else /* SUBSTRING not supported */
...;

Related Functions

For information about

See

Returning the setting of a connection option

SQLGetConnectOption (extension)

Determining if a driver supports a function

SQLGetFunctions (extension)

Returning the setting of a statement option

SQLGetStmtOption (extension)

Returning information about a data source’s data types

SQLGetTypeInfo (extension)

SQLGetStmtOption (ODBC 1.0, Level 1)

SQLGetStmtOption returns the current setting of a statement option.

Syntax

RETCODE SQLGetStmtOption(hstmt, fOption, pvParam)

The SQLGetStmtOption function accepts the following arguments:

Type

Argument

Use

Description

HSTMT

hstmt

Input

Statement handle.

UWORD

fOption

Input

Option to retrieve.

PTR

pvParam

Output

Value associated with fOption. Depending on the value of fOption, a 32-bit integer value or a pointer to a null-terminated character string will be returned in pvParam.

Returns

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

Diagnostics

When SQLGetStmtOption returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLError. The following table lists the SQLSTATE values commonly returned by SQLGetStmtOption and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

SQLSTATE

Error

Description

01000

General warning

Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)

24000

Invalid cursor state

The argument fOption was SQL_ROW_NUMBER or SQL_GET_BOOKMARK and the cursor was not open, or the cursor was positioned before the start of the result set or after the end of the result set.

IM001

Driver does not support this function

(DM) The driver corresponding to the hstmt does not support the function.

S1000

General error

An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLError in the argument szErrorMsg describes the error and its cause.

S1001

Memory allocation failure

The driver was unable to allocate memory required to support execution or completion of the function.

S1010

Function sequence error

(DM) An asynchronously executing function was called for the hstmt and was still executing when this function was called.

(DM) SQLExecute, SQLExecDirect, or SQLSetPos was called for the hstmt and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

S1011

Operation invalid at this time

The fOption argument was SQL_GET_BOOKMARK and the value of the SQL_USE_BOOKMARKS statement option was SQL_UB_OFF.

S1092

Option type out of range

(DM) The value specified for the argument fOption was in the block of numbers reserved for ODBC connection and statement options, but was not valid for the version of ODBC supported by the driver.

S1109

Invalid cursor position

The fOption argument was SQL_GET_BOOKMARK or SQL_ROW_NUMBER and the value in the rgfRowStatus array in SQLExtendedFetch for the current row was SQL_ROW_DELETED or SQL_ROW_ERROR.

S1C00

Driver not capable

The value specified for the argument fOption was a valid ODBC statement option for the version of ODBC supported by the driver, but was not supported by the driver.

The value specified for the argument fOption was in the block of numbers reserved for driver-specific connection and statement options, but was not supported by the driver.

Comments

The following table lists statement options for which corresponding values can be returned, but not set. The table also lists the version of ODBC in which they were introduced. For a list of options that can be set and retrieved, see SQLSetStmtOption. If fOption specifies an option that returns a string, pvParam must be a pointer to storage for the string. The maximum length of the string will be SQL_MAX_OPTION_STRING_LENGTH bytes (excluding the null termination byte).

fOption

pvParam contents

SQL_GET_BOOKMARK
(ODBC 2.0)

A 32-bit integer value that is the bookmark for the current row. Before using this option, an application must set the SQL_USE_BOOKMARKS statement option to SQL_UB_ON, create a result set, and call SQLExtendedFetch.

To return to the rowset starting with the row marked by this bookmark, an application calls SQLExtendedFetch with the SQL_FETCH_BOOKMARK fetch type and irow set to this value.

Bookmarks are also returned as column 0 of the result set.

SQL_ROW_NUMBER
(ODBC 2.0)

A 32-bit integer value that specifies the number of the current row in the entire result set. If the number of the current row cannot be determined or there is no current row, the driver returns 0.

Related Functions

For information about

See

Returning the setting of a connection option

SQLGetConnectOption (extension)

Setting a connection option

SQLSetConnectOption (extension)

Setting a statement option

SQLSetStmtOption (extension)

SQLGetTypeInfo (ODBC 1.0, Level 1)

SQLGetTypeInfo returns information about data types supported by the data source. The driver returns the information in the form of an SQL result set.


Important Applications must use the type names returned in the TYPE_NAME column in ALTER TABLE and CREATE TABLE statements; they must not use the sample type names listed in Appendix C, "SQL Grammar." SQLGetTypeInfo may return more than one row with the same value in the DATA_TYPE column.

Syntax

RETCODE SQLGetTypeInfo(hstmt, fSqlType)

The SQLGetTypeInfo function accepts the following arguments:

Type

Argument

Use

Description

HSTMT

hstmt

Input

Statement handle for the result set.

SWORD

fSqlType

Input

The SQL data type. This must be one of the following values:

SQL_BIGINT
SQL_BINARY
SQL_BIT
SQL_CHAR
SQL_DATE
SQL_DECIMAL
SQL_DOUBLE
SQL_FLOAT
SQL_INTEGER
SQL_LONGVARBINARY
SQL_LONGVARCHAR
SQL_NUMERIC
SQL_REAL
SQL_SMALLINT
SQL_TIME
SQL_TIMESTAMP
SQL_TINYINT
SQL_VARBINARY
SQL_VARCHAR

or a driver-specific SQL data type. SQL_ALL_TYPES specifies that information about all data types should be returned.

For information about ODBC SQL data types, see "SQL Data Types" in Appendix D, "Data Types." For information about driver-specific SQL data types, see the driver’s documentation.

Returns

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

Diagnostics

When SQLGetTypeInfo returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLError. The following table lists the SQLSTATE values commonly returned by SQLGetTypeInfo and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

SQLSTATE

Error

Description

01000

General warning

Driver specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)

08S01

Communication link failure

The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.

24000

Invalid cursor state

(DM) A cursor was open on the hstmt and SQLFetch or SQLExtendedFetch had not been called.

A result set was open on the hstmt but SQLFetch or SQLExtendedFetch had not been called.

IM001

Driver does not support this function

(DM) The driver corresponding to the hstmt does not support the function.

S1000

General error

An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLError in the argument szErrorMsg describes the error and its cause.

S1001

Memory allocation failure

The driver was unable to allocate memory required to support execution or completion of the function.

S1004

SQL data type out of range

(DM) The value specified for the argument fSqlType was in the block of numbers reserved for ODBC SQL data type indicators but was not a valid ODBC SQL data type indicator.

S1008

Operation canceled

Asynchronous processing was enabled for the hstmt, then the function was called and before it completed execution, SQLCancel was called on the hstmt. Then the function was called again on the hstmt.

The function was called and, before it completed execution, SQLCancel was called on the hstmt from a different thread in a multithreaded application.

S1010

Function sequence error

(DM) An asynchronously executing function (not this one) was called for the hstmt and was still executing when this function was called.

(DM) SQLExecute, SQLExecDirect, or SQLSetPos was called for the hstmt and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

S1C00

Driver not capable

The value specified for the argument fSqlType was in the range of numbers reserved for driver-specific SQL data type indicators, but was not supported by the driver or data source.



The combination of the current settings of the SQL_CONCURRENCY and SQL_CURSOR_TYPE statement options was not supported by the driver or data source.

S1T00

Timeout expired

The timeout period expired before the data source returned the result set. The timeout period is set through SQLSetStmtOption, SQL_QUERY_TIMEOUT.

Comments

SQLGetTypeInfo returns the results as a standard result set, ordered by DATA_TYPE and TYPE_NAME. The following table lists the columns in the result set.


Note. SQLGetTypeInfo might not return all data types. For example, a driver might not return user-defined data types. Applications can use any valid data type, regardless of whether it is returned by SQLGetTypeInfo.

The lengths of VARCHAR columns shown in the table are maximums; the actual lengths depend on the data source.

Column Name

Data Type

Comments

TYPE_NAME

Varchar(128)
not NULL

Data source–dependent data type name; for example, "CHAR", "VARCHAR", "MONEY", "LONG VARBINARY", or "CHAR ( ) FOR BIT DATA". Applications must use this name in CREATE TABLE and ALTER TABLE statements.

DATA_TYPE

Smallint
not NULL

SQL data type. This can be an ODBC SQL data type or a driver-specific SQL data type. For a list of valid ODBC SQL data types, see "SQL Data Types" in Appendix D, "Data Types." For information about driver-specific SQL data types, see the driver’s documentation.

PRECISION

Integer

The maximum precision of the data type on the data source. NULL is returned for data types where precision is not applicable. For more information on precision, see "Precision, Scale, Length, and Display Size" in Appendix D, "Data Types."

LITERAL_PREFIX

Varchar(128)

Character or characters used to prefix a literal; for example, a single quote ( ' ) for character data types or 0x for binary data types; NULL is returned for data types where a literal prefix is not applicable.

LITERAL_SUFFIX

Varchar(128)

Character or characters used to terminate a literal; for example, a single quote ( ' ) for character data types; NULL is returned for data types where a literal suffix is not applicable.

CREATE_PARAMS

Varchar(128)

Parameters for a data type definition. For example, CREATE_PARAMS for DECIMAL would be "precision,scale"; CREATE_PARAMS for VARCHAR would equal "max length"; NULL is returned if there are no parameters for the data type definition, for example INTEGER.

The driver supplies the CREATE_PARAMS text in the language of the country where it is used.

NULLABLE

Smallint
not NULL

Whether the data type accepts a NULL value:

SQL_NO_NULLS if the data type does not accept NULL values.

SQL_NULLABLE if the data type accepts NULL values.

SQL_NULLABLE_UNKNOWN if it is not known if the column accepts NULL values.

CASE_SENSITIVE

Smallint
not NULL

Whether a character data type is case sensitive in collations and comparisons:

TRUE if the data type is a character data type and is case sensitive.

FALSE if the data type is not a character data type or is not case sensitive.

SEARCHABLE

Smallint
not NULL

How the data type is used in a WHERE clause:

SQL_UNSEARCHABLE if the data type cannot be used in a WHERE clause.

SQL_LIKE_ONLY if the data type can be used in a WHERE clause only with the LIKE predicate.

SQL_ALL_EXCEPT_LIKE if the data type can be used in a WHERE clause with all comparison operators except LIKE.

SQL_SEARCHABLE if the data type can be used in a WHERE clause with any comparison operator.

UNSIGNED_ATTRIBUTE

Smallint

Whether the data type is unsigned:

TRUE if the data type is unsigned.

FALSE if the data type is signed.

NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.

MONEY

Smallint
not NULL

Whether the data type is a money data type:

TRUE if it is a money data type.

FALSE if it is not.

AUTO_INCREMENT

Smallint

Whether the data type is autoincrementing:

TRUE if the data type is autoincrementing.

FALSE if the data type is not autoincrementing.

NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.

An application can insert values into a column having this attribute, but cannot update the values in the column.

LOCAL_TYPE_NAME

Varchar(128)

Localized version of the data source–dependent name of the data type. NULL is returned if a localized name is not supported by the data source. This name is intended for display only, such as in dialog boxes.

MINIMUM_SCALE

Smallint

The minimum scale of the data type on the data source. If a data type has a fixed scale, the MINIMUM_SCALE and MAXIMUM_SCALE columns both contain this value. For example, an SQL_TIMESTAMP column might have a fixed scale for fractional seconds. NULL is returned where scale is not applicable. For more information, see "Precision, Scale, Length, and Display Size" in Appendix D, "Data Types."

MAXIMUM_SCALE

Smallint

The maximum scale of the data type on the data source. NULL is returned where scale is not applicable. If the maximum scale is not defined separately on the data source, but is instead defined to be the same as the maximum precision, this column contains the same value as the PRECISION column. For more information, see "Precision, Scale, Length, and Display Size" in Appendix D, "Data Types."


Note. The MINIMUM_SCALE and MAXIMUM_SCALE columns were added in ODBC 2.0. ODBC 1.0 drivers may return different, driver-specific columns with the same column numbers.

Attribute information can apply to data types or to specific columns in a result set. SQLGetTypeInfo returns information about attributes associated with data types; SQLColAttributes returns information about attributes associated with columns in a result set.

Related Functions

For information about

See

Assigning storage for a column in a result set

SQLBindCol

Canceling statement processing

SQLCancel

Returning information about a column in a result set

SQLColAttributes

Fetching a block of data or scrolling through a result set

SQLExtendedFetch (extension)

Fetching a row of data

SQLFetch

Returning information about a driver or data source

SQLGetInfo (extension)

SQLMoreResults (ODBC 1.0, Level 2)

SQLMoreResults determines whether there are more results available on an hstmt containing SELECT, UPDATE, INSERT, or DELETE statements and, if so, initializes processing for those results.

Syntax

RETCODE SQLMoreResults(hstmt)

The SQLMoreResults function accepts the following argument:

Type

Argument

Use

Description

HSTMT

hstmt

Input

Statement handle.

Returns

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_NO_DATA_FOUND, SQL_ERROR, or SQL_INVALID_HANDLE.

Diagnostics

When SQLMoreResults returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLError. The following table lists the SQLSTATE values commonly returned by SQLMoreResults and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

SQLSTATE

Error

Description

01000

General warning

Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)

IM001

Driver does not support this function

(DM) The driver associated with the hstmt does not support the function.

S1000

General error

An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLError in the argument szErrorMsg describes the error and its cause.

S1001

Memory allocation failure

The driver was unable to allocate memory required to support execution or completion of the function.

S1008

Operation canceled

Asynchronous processing was enabled for the hstmt. The function was called and before it completed execution, SQLCancel was called on the hstmt. Then the function was called again on the hstmt.

The function was called and, before it completed execution, SQLCancel was called on the hstmt from a different thread in a multithreaded application.

S1010

Function sequence error

(DM) An asynchronously executing function (not this one) was called for the hstmt and was still executing when this function was called.

(DM) SQLExecute, SQLExecDirect, or SQLSetPos was called for the hstmt and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

S1T00

Timeout expired

The timeout period expired before the data source returned the result set. The timeout period is set through SQLSetStmtOption, SQL_QUERY_TIMEOUT.

Comments

SELECT statements return result sets. UPDATE, INSERT, and DELETE statements return a count of affected rows. If any of these statements are batched, submitted with arrays of parameters, or in procedures, they can return multiple result sets or counts.

If another result set or count is available, SQLMoreResults returns SQL_SUCCESS and initializes the result set or count for additional processing. After calling SQLMoreResults for SELECT statements, an application can call functions to determine the characteristics of the result set and to retrieve data from the result set. After calling SQLMoreResults for UPDATE, INSERT, or DELETE statements, an application can call SQLRowCount.

If all results have been processed, SQLMoreResults returns SQL_NO_DATA_FOUND.

Note that if there is a current result set with unfetched rows, SQLMoreResults discards that result set and makes the next result set or count available.

If a batch of statements or a procedure mixes other SQL statements with SELECT, UPDATE, INSERT, and DELETE statements, these other statements do not affect SQLMoreResults.

For additional information about the valid sequencing of result-processing functions, see Appendix B, "ODBC State Transition Tables."

Related Functions

For information about

See

Canceling statement processing

SQLCancel

Fetching a block of data or scrolling through a result set

SQLExtendedFetch (extension)

Fetching a row of data

SQLFetch

Fetching part or all of a column of data

SQLGetData (extension)

Previous Page TOC Index Next Page

Copyright © 1992-1997 Solid Information Technology Ltd All rights reserved.