tbCLI Functions
This chapter describes functions supported by tbCLI.
SQL-99 Standard API
SQLAllocConnect(Deprecated)
Related Function The SQLAllocConnect function is replaced by the SQLAllocHandle function in ODBC 3.x.
SQLAllocEnv(Deprecated)
An application program can use a single environment at a time. This function allocates and initializes the environment handle and related memory.
To receive the environment handle, the SQLAllocEnv function should be called before the SQLAllocConnect function is called. After the function is called, the handle is sent to all functions that require the environment handle. For reference, if the SQLFreeEnv function is called, the existing environment handle is returned.
Related Function The SQLAllocEnv function is replaced by the SQLAllocHandle function in ODBC 3.x.
SQLAllocHandle
This function is used to allocate environment, connection and statement handles.
ISO 92 CLI/ODBC 3.0 supports the function. The function initializes resources, environment, and command handles, and allocates memory.
Syntax
SQLRETURN SQLAllocHandle (SQLSMALLINT HandleType,
SQLHANDLE InputHandle,
SQLHANDLE *OutputHandle);
Parameters
HandleType
Input
Handle type to be allocated. Has one value among the following types.
SQL_HANDLE_ENV
SQL_HANDLE_DBC
SQL_HANDLE_STMT
InputHandle
Input
Input handle. Has a different value depending on the handle type.
SQL_HANDLE_ENV: SQL_NULL_HANDLE
SQL_HANDLE_DBC: Environment handle
SQL_HANDLE_STMT: Connection handle
OutputHandle
Output
Handle pointer to be allocated. If SQL_ERROR is returned when allocating a handle other than the environment handle, SQL_NULL_HDBC and SQL_NULL_HSTMT are allocated to OutputHandle parameters.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
08003
Database connection does not exist.
HY000
General error
HY001
Memory allocation error
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error
HY013
Memory management error
HY014
The number of handles exceeds the limited range.
HY092
Invalid property and option identifier
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLAllocHandle function.
Related Function SQLAllocHandle replaces SQLAllocConnect, SQLAllocEnv, and SQLAllocstmt. For application programs which use ODBC 2.x driver, to work properly, the SQLAllocHandle function should be replaced by SQLAllocConnect, SQLAllocEnv, or SQLAllocstmt functions accordingly.
SQLAllocStmt(Deprecated)
This function gets the allocation of statement handle to process the descriptor, result value, cursor information, and status information in tbCLI. If the function is called, it allocates and initializes memory for statements. For one database connection, 1,024 statements can be allocated.
Related Function SQLAllocStmt is replaced by the SQLAllocHandle in ODBC 3.x.
SQLBindCol
Supported by ISO 92 CLI/ODBC 1.0. The function sets up the buffer and data type to receive the columns of a result set.
For all data types, the function relates the columns of result set to application program variables. The position referenced by the function is not updated and remains valid until the SQLFetch function is called.
If the SQLFetch function is called, data is transferred from database server to application program. Therefore this function should be called before the SQLFetch function is used.
Details of the SQLBindCol function are as follows.
Syntax
SQLRETURN SQLBindCol (SQLHSTMT StatementHandle,
SQLUSMALLINT ColumnNumber,
SQLSMALLINT TargetType,
SQLPOINTER TargetValue,
SQLINTEGER BufferLength,
SQLINTEGER *StrLen_or_Ind);
Parameters
StatementHandle
Input
Statement handle
ColumnNumber
Input
Column number
TargetType
Input
C data type
TargetValue
Input/Output
Pointer of the buffer to receive the columns
BufferLength
Input
Buffer size on unit of byte
StrLen_or_IndPtr
Input/Output
Length data stored in the buffer
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
07006
Violation of limited data type property
07009
Invalid descriptor index
HY000
General error
HY001
Memory allocation error
HY003
Invalid application buffer type
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
The database connection time out exceeded.
SQLBindParameter
Supported by ISO 92 CLI/ODBC 2.0. This function binds SQL statement's parameters to application program variables.
Syntax
SQLRETURN SQLBindParameter (SQLHSTMT StatementHandle
SQLUSMALLINT ParameterNumber,
SQLSMALLINT InputOutputType,
SQLSMALLINT ValueType,
SQLSMALLINT ParameterType,
SQLULEN ColumnSize,
SQLSMALLINT DecimalDigits,
SQLPOINTER ParameterValue,
SQLLEN BufferLength,
SQLLEN *StrLen_or_IndPtr);
Parameters
StatementHandle
Input
Statement handle
ParameterNumber
Input
Parameter position
InputOutputType
Input
Parameter types
ValueType
Input
C data type
ParameterType
Input
SQL data type
ColumnSize
Input
Precision
Varies depending on the data type:
• SQL_CHAR: The maximum length
• SQL_NUMERIC: The maximum decimal precision
DecimalDigits
Input
If SQL_NUMERIC, the number of digits lower than the decimal
point.
ParameterValue
Input/Output
Parameter pointer
BufferLength
Input
The maximum buffer size
StrLen_or_Ind
Input/Output
Input/Output data size
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
07006
Violation of limited data type property
07009
Invalid descriptor index
HY000
General error
HY001
Memory allocation error
HY003
Invalid application buffer type
HY004
Invalid SQL data type
HY009
NULL pointer is incorrectly used. .
HY010
Function sequence error
HY013
Memory management error
HY021
Inconsistent descriptor information
HY090
Invalid character string or buffer length
HY104
Invalid precision or scale value
HY105
Invalid parameter type
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLBindParameter function.
SQLCancel
Supported by ISO 92 CLI/ODBC 3.0. This function cancels the operation of the SQL statement that is currently running.
Syntax
SQLRETURN SQLCancel (SQLHSTMT StatementHandle);
Parameters
StatementHandle
Input
Statement handle
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HY018
Operation is canceled
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLCancel function.
SQLCloseCursor
Supported by ISO 92 CLI/ODBC 3.0. This function cancels the cursor. In other words, the function closes the currently executing SQL statement and cancels the result.
Syntax
SQLRETURN SQLCloseCursor (SQLHSTMT StatementHandle);
Parameters
StatementHandle
Input
Statement handle
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
24000
Invalid cursor status
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLCloseCursor function.
SQLColAttribute
Supported by ISO 92 CLI/ODBC 3.0. This function sets up a property to a certain column of the result set and checks the information. If the information to be checked is a character string, the information is returned to the CharacterAttribute parameter, and if it is a number, it is returned to the NumericAttribute parameter.
Before this function is called, the SQLPrepare or SQLExecDirect function should be called.
Syntax
SQLRETURN SQLColAttribute (SQLHSTMT StatementHandle,
SQLUSMALLINT ColumnNumber,
SQLUSMALLINT FieldIdentifier,
SQLPOINTER CharacterAttribute,
SQLSMALLINT BufferLength,
SQLSMALLINT *StringLength,
SQLPOINTER NumericAttribute);
Parameters
StatementHandle
Input
Statement handle
ColumnNumber
Input
Column position
FieldIdentifier
Input
Information to check
CharacterAttribute
Output
Buffer pointer
BufferLength
Input
The maximum size of buffer
StringLength
Output
Returned character string length
NumericAttribute
Output
Returned number
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
07005
Prepared statement is out of cursor range.
7009
Invalid descriptor index
HY000
General error
HY001
Memory allocation error
HY008
Operation is canceled
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HY091
Invalid descriptor field identifier
HYC00
Optional feature is not implemented
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLColAttribute function.
SQLColAttributes(Deprecated)
The SQLColAttributes function is replaced by the SQLColAttribute function in ODBC 3.x.
SQLColumnPrivileges
Supported by ISO 92 CLI/ODBC 1.0. This function searches or returns authorities related to certain table's column list. The returned information is represented as a result set.
Syntax
SQLRETURN SQLColumnPrivileges (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *TableName,
SQLSMALLINT NameLength3,
SQLCHAR *ColumnName,
SQLSMALLINT NameLength4);
Parameters
StatementHandle
Input
Statement handle
CatalogName
Input
Catalog name
NameLength1
Input
Catalog name length
SchemaName
Input
Schema name
NameLength2
Input
Schema name length
TableName
Input
Table name
NameLength3
Input
Table name length
ColumnName
Input
Column name
NameLength4
Input
Column name length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
08S01
Failed to connect server for communication
24000
Invalid cursor state
40001
Serialization failure
40003
The execution has not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used. .
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
HYT00
Limit time exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLColumnPrivileges function.
SQLColumns
Supported by XopenCLI/ISO 92 CLI/ODBC 1.0. This function searches the information of a certain column or list, and returns the result set.
Syntax
SQLRETURN SQLColumns (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *TableName,
SQLSMALLINT NameLength3,
SQLCHAR *ColumnName,
SQLSMALLINT NameLength4);
Parameters
StatementHandle
Input
Statement handle
CatalogName
Input
Catalog name
NameLength1
Input
Catalog name length
SchemaName
Input
Schema name to search
NameLength2
Input
Schema name length
TableName
Input
Table name to search
NameLength3
Input
Table name length
ColumnName
Input
Column ID to search
NameLength4
Input
Length of the column ID to search
Return Column
1
TABLE_CAT
VARCHAR
Catalog name
2
TABLE_SCHEM
VARCHAR
Schema name
3
TABLE_NAME
VARCHAR(NOT NULL)
Table or view name
4
COLUMN_NAME
VARCHAR(NOT NULL)
Column ID
5
DATA_TYPE
NUMERIC(NOT NULL)
SQL data type for column
6
TYPE_NAME
VARCHAR(NOT NULL)
Character string representing DATA_TYPE column
7
COLUMN_SIZE
NUMERIC
The maximum size of a column
8
BUFFER_LENGTH
NUMERIC
The maximum size of a buffer to store data
9
DECIMAL_DIGITS
NUMERIC
The number of digits after the decimal point, of a column
10
NUM_PREC_RADIX
NUMERIC
One value among 10, 2, or NULL
- If DATA_TYPE column is a number: 2
- COLUMN_SIZE column: The number of bits allowed to insert
11
NULLABLE
NUMERIC(NOT NULL)
Whether NULL value can be used.
12
REMARKS
VARCHAR
Column description
13
COLUMN_DEF
VARCHAR
Default value of a column
14
SQL_DATA_TYPE
NUMERIC(NOT NULL)
SQL data type
15
SQL_DATETIME_SUB
NUMERIC
Internal data type
16
CHAR_OCTET_LENGTH
NUMERIC
The maximum number of bytes in a column
17
ORDINAL_POSITION
NUMERIC(NOT NULL)
The original position of table column
18
IS_NULLABLE
VARCHAR
Whether the row contains NULL
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
08S01
Failed to connect to server for communication.
24000
Invalid cursor state
40001
Serialization failure
40003
The execution is not finished and the transaction state is unknown.
HY000
General error
HY001
Memory allocation error
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used. .
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HYC00
Optional feature is not implemented.
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLColumns function.
SQLConnect
Supported by ISO 92 CLI/ODBC 1.0. This function configures the database to be connected. Application program provides the database with SQL, and can selectively offer the information related to authority and authentication.
Before this function, the SQLAllocConnect function should be called.
Syntax
SQLRETURN SQLConnect(SQLHDBC ConnectionHandle,
SQLCHAR *ServerName,
SQLSMALLINT NameLength1,
SQLCHAR *UserName,
SQLSMALLINT NameLength2,
SQLCHAR *Authentication,
SQLSMALLINT NameLength3);
Parameters
ConnectionHandle
Input
Connection handle
ServerName
Input
Database name pointer
NameLength1
Input
Database name length
UserName
Input
User ID pointer
NameLength2
Input
User ID length
Authentication
Input
Password pointer related to authentication
NameLength3
Input
Password pointer related to authentication
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01S02
Option value has changed.
08001
Client cannot connect to server.
08002
The database connection name is already used.
08004
Server denied the connection.
08S01
Failed to connect to server for communication.
28000
Invalid authority is configured.
HY000
General error
HY001
Memory allocation error
HY013
Memory management error
HY090
Invalid character string or buffer length
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLConnect function.
IM002
Unable to find the datasource name or default driver does not exist.
IM003
Unable to load the configured driver.
IM004
Failed to allocate an environment handle to the driver by using the SQLAllocHandle function.
IM005
Failed to allocate a connection handle to the driver by using the SQLAllocHandle function.
IM006
Failed to configure the database connection properties to the driver by using the SQLSetConnectAttr function.
IM009
Unable to connect to translation DLL.
IM010
Datasource name is longer than the value configured in the SQL_MAX_DSN_LENGTH parameter.
SQLCopyDesc
Supported by ISO 92 CLI/ODBC 3.0. This function copies the descriptor information to other descriptor handles.
Syntax
SQLRETURN SQLCopyDesc (SQLHDESC SourceDescHandle,
SQLHDESC TargetDescHandle);
Parameters
SourceDescHandle
Input
Original descriptor handle
TargetDescHandle
Input
Target descriptor handle
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01S02
Option value has changed.
08001
Client cannot connect to the server.
08002
The database connection name is already used.
08004
Server denied the connection.
08S01
Failed to connect to server for communication.
28000
Invalid authority is configured.
HY000
General error.
HY001
Memory allocation error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYT00
Connection timeout.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLCopyDesc function.
IM002
Unable to find the datasource name or default driver does not exist.
IM003
Unable to load the configured driver.
IM004
Failed to allocate an environment handle to the driver by using the
SQLAllocHandle function.
IM005
Failed to allocate a connection handle to the driver by using the
SQLAllocHandle function.
IM006
Failed to configure the database connection properties to driver by using
the SQLSetConnectAttr function.
IM009
Unable to connect to translation DLL.
SQLDescribeCol
Supported by ISO 92 CLI/ODBC 1.0. This function checks the information of certain column name, data type, precision, scale, and whether NULL is used in the result set.
Before the function is called, SQLPrepare or SQLExecDirect function should be called.
Syntax
SQLRETURN SQLDescribeCol (SQLHSTMT StatementHandle,
SQLUSMALLINT ColumnNumber,
SQLCHAR *ColumnName,
SQLSMALLINT BufferLength,
SQLSMALLINT *NameLength,
SQLSMALLINT *DataType,
SQLUINTEGER *ColumnSize,
SQLSMALLINT *DecimalDigits,
SQLSMALLINT *Nullable);
Parameters
StatementHandle
Input
Statement handle
ColumnNumber
Input
Column position
ColumnName
Output
Column name pointer
BufferLength
Input
Buffer size to store the column name
NameLength
Output
Column name length
DataType
Output
Column data type
ColumnSize
Output
Column precision
DecimalDigits
Output
Column scale
Nullable
Output
Whether to allow NULL for the column
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
07005
Prepared statement is out of cursor range.
07009
Invalid descriptor index.
08S01
Failed to connect server for communication.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLDescribeCol function.
SQLDescribeParam
Supported by ODBC 1.0. This function returns the descriptor of parameter symbol related to the prepared SQL statement.
Syntax
SQLRETURN SQLDescribeParam (SQLHSTMT StatementHandle,
SQLUSMALLINT ParameterNumber,
SQLSMALLINT *DataType,
SQLUINTEGER *ParameterSize,
SQLSMALLINT *DecimalDigits,
SQLSMALLINT *Nullable);
Parameters
Parameter
Purpose
Description
StatementHandle
Input
Statement handle.
ParameterNumber
Input
Parameter marker number.
DataType
Output
SQL data type for parameter.
ParameterSize
Output
Buffer pointer to which column size will be returned.
DecimalDigits
Output
Buffer pointer to which column precision will be returned.
Nullable
Output
Buffer pointer to which the option whether NULL is allowed for the parameter will be returned. Has one value among the following.
SQL_NO_NULLS: NULL is not allowed.
SQL_NULLABLE: NULL is allowed.
SQL_NULLABLE_UNKNOWN: Cannot decide whether NULL is allowed or not.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
07009
Invalid descriptor index.
08S01
Failed to connect server for communication.
21S01
The list to be inserted and the column do not match.
HY000
General error
HY001
Memory allocation error
HY008
Operation is canceled.
HY010
Function sequence error
HY013
Memory management error
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLDescribeParam function.
SQLDisconnect
Supported by ISO 92 CLI/ODBC 1.0. This function ends the database connection related to a connection handle. If this function is called, the database connection is ended and the handle is canceled. After the handle is successfully canceled, if the SQLConnect function is called, the application program cannot use the connection handle again.
To connect to another database, after calling the function, use SQLConnect or SQLFreeConnect function.
Syntax
SQLRETURN SQLDisconnect (SQLHDBC ConnectionHandle);
Parameters
ConnectionHandle
Input
Connection handle
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01002
An error occurred while disconnecting database.
08003
Database connection does not exist.
25000
Invalid transaction state.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLDisconnect function.
SQLDriverConnect
Supported in CLI/ODBC 1.0. This function specifies the target database (to be connected to). This function is used when information, not including the three parameters provided by the SQLConnect function, is required.
SQLAllocConnect must be called before this function.
Syntax
SQLRETURN SQLDriverConnect (SQLHDBC ConnectionHandle,
SQLHWND WindowHandle,
SQLCHAR *InConnectionString,
SQLSMALLINT StringLength1,
SQLCHAR *OutConnectionString,
SQLSMALLINT BufferLength,
SQLSMALLINT *StringLength2Ptr,
SQLUSMALLINT DriverCompletion);
Parameters
ConnectionHandle
Input
Connection handle
WindowHandle
Input
Not used. (NULL)
InConnectionString
Input
Connection character string.
This string consists of a series of keyword=value pairs separated by semicolons.
Windows provides DSN, DESC(=Description), UID(=User), PWD(=Password), Server, Port, DB(=Database), SID, Connection Method, Option, and Updatable Cursor as keywords.
UNIX series provide DSN, DESC(=Description), UID(=User), PWD(=Password), SID, Option and Updatable Cursor as keywords.
If Updatable Cursor is specified as True, the cursor type for result sets retrieved through the connection is set as KEYSET DRIVEN. If not specified, the default cursor type is FORWARD ONLY.
StringLength1
Input
Length of the connection character string.
OutConnectionString
Output
Pointer that saves the completed connection string. Buffer must be a minimum of 1024 bytes. If set to NULL, BufferLength and StringLength2Ptr are also ignored.
BufferLength
Input
Byte length of the buffer.
StringLength2Ptr
Output
Length of the data that is saved in the buffer.
DriverCompletion
Input
Not used. (Input SQL_DRIVER_NOPROMPT)
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
01S02
Option value has changed.
08001
Client cannot connect to server.
08002
Database connection name is already used.
08004
Connected denied by server.
08S01
Failed to connect to server for communication
28000
Invalid authority is configured.
HY000
General error.
HY001
Memory allocation error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYT00
Connection timeout.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLDriverConnect function.
IM002
Unable to find the datasource name or default driver does not exist.
IM003
Unable to load the configured driver.
IM004
Failed to allocate an environment handle to the driver by using the
SQLAllocHandle function.
IM005
Failed to allocate a connection handle to the driver by using the SQLAllocHandle function.
IM006
Failed to configure the database connection properties to the driver by using the SQLSetConnectAttr function.
IM009
Unable to connect to translation DLL.
IM010
Datasource name is longer than the value configured in SQL_MAX_DSN_LENGTH.
SQLEndTran
Supported by ISO 92 CLI/ODBC 3.0. This function commits or rolls back the current transaction. Whether to commit or roll back is decided by the CompletionType Parameter of the SQLEndTran function.
If there is currently no working transaction, the function returns SQL_SUCCESS without accessing database server.
Syntax
SQLRETURN SQLEndTran (SQLSMALLINT HandleType,
SQLHANDLE Handle,
SQLSMALLINT CompletionType);
Parameters
HandleType
Input
Handle type to be allocated. Has one value among the following.
SQL_HANDLE_ENV
SQL_HANDLE_DBC
Handle
Input
Handle pointer.
CompletionType
Input
Type which presents whether to commit or to rollback. Has one value among the following.
SQL_COMMIT
SQL_ROLLBACK
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
08003
Database connection does not exist.
08007
Failed to connect to the database while processing the transaction.
25S01
Transaction state.
25S02
Transaction has not been activated.
25S03
Transaction has been rolled back.
40001
Serialization failure.
40002
Violation of integrity constraint.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY012
Invalid transaction operation code.
HY013
Memory management error.
HY092
Invalid property and option identifier.
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLEndTran function.
SQLError(Deprecated)
This function returns the information about error and state of the recently called function for a certain command, database connection or environment handle.
Related Function SQLError is replaced by SQLGetDiagRec in ODBC 3.x.
SQLExecDirect
Supported by ISO 92 CLI/ODBC 1.0. This function directly executes SQL statements except transaction related statements such as commit and rollback.
In order to execute commit or rollback, the SQLTransact function should be called. Before the SQLExecDirect function is called, all parameters should be bound, and the database server to be connected to should be prepared in an SQL statement, in advance. The SQL statements are executed only once.
Syntax
SQLRETURN SQLExecDirect (SQLHSTMT StatementHandle,
SQLCHAR *StatementText,
SQLINTEGER TextLength);
Parameters
StatementHandle
Input
Statement handle.
StatementText
Input
SQL statement.
TextLength
Input
SQL statement text length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_NEED_DATA
More data is required to execute the SQL statement. (Ex: Parameter)
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01001
Cursor operation is conflicted.
01003
NULL is deleted in the configured function.
01004
Character string is truncated from the right.
01006
Unreturned privilege.
01007
Not granted privilege.
01S02
Option value is changed.
01S07
Part of information of numeric type or date type is truncated.
07002
Error in the COUNT field.
07006
Violation of limited data type property.
07S01
Default parameter is incorrectly used.
08S01
Failed to connect server for communication.
21S01
The list to be inserted and the column do not match.
21S02
Table's degree and column do not match.
22001
Character string is truncated from the right.
22002
Indicator variable is required but not offered.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format.
22008
Overflow occurred to the DATETIME field.
22012
Divided by 0.
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration.
22019
Invalid escape character.
22025
Invalid escape sequence.
23000
Violation of integrity constraint.
24000
Invalid cursor state.
34000
Invalid cursor name.
3D000
Invalid catalog name.
3F000
Invalid schema name.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
42000
Syntax error or access violation occurred.
42S01
Base table or view already exists.
42S02
Unable to find the base table or view.
42S11
Index already exists.
42S12
Unable to find the index.
42S21
Column already exists.
42S22
Unable to find the column.
44000
Violation of WITH CHECK OPTION.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used. .
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY105
Invalid parameter type.
HY109
Invalid cursor position.
HYC00
Optional feature is not implemented.
HYT00
Connection timeout.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLExecDirect function.
SQLExecute
Supported by ISO 92 CLI/ODBC 1.0. This function executes the prepared SQL statements once or multiple times. SQL statements use the SQLBindParameter function to apply the current values to the application program variables which are bound by parameter maker.
If an application program uses the SQLExecute function to process the call result, the SQL statement can be executed again by applying new values to application program variables.
Syntax
SQLRETURN SQLExecute (SQLHSTMT StatementHandle);
Parameters
StatementHandle
Input
Statement handle.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement)
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_NEED_DATA
More data is required to execute the SQL statement. (Ex: Parameter)
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01001
Cursor operation is conflicted.
01003
NULL is deleted in the configured function.
01004
Character string is truncated from the right.
01006
Unreturned privilege.
01007
Not granted privilege.
01S02
Option value is changed.
01S07
Part of information of numeric type or date type is truncated.
07002
Error in the COUNT field.
07006
Violation of limited data type property.
07S01
Default parameter is incorrectly used.
08S01
Failed to connect server for communication.
21S01
The list to be inserted and the columns do not match.
21S02
Table's degree and column do not match.
22001
Character string is truncated from the right.
22002
Indicator variable is required but not offered.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format.
22008
Overflow occurred to the DATETIME field.
22012
Divided by 0.
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration.
22019
Invalid escape character.
22025
Invalid escape sequence.
23000
Violation of integrity constraint.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution is not finished and the transaction state is unknown.
42000
Syntax error or access violation occurred.
44000
Violation of WITH CHECK OPTION.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY105
Invalid parameter type.
HY109
Invalid cursor position.
HYC00
Optional feature is not implemented.
HYT00
Connection Timeout.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLExecute function.
SQLExtendedFetch(Deprecated)
The SQLExtendedFetch function is replaced by the SQLFetchScroll function in ODBC 3.x.
SQLExtProcRaiseError
Supported for the external procedure module, this function generates an error.
Syntax
void SQL_API SQLExtProcRaiseError(ExtProcContext *Context, int ErrorCode);
Parameters
Context
Input
Context
ErrorCode
Input
Error code
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
HY000
General error.
HY001
Memory allocation error.
SQLExtProcRaiseErrorWithMsg
Supported for the external procedure module, this function generates an error with a message.
Syntax
void SQL_API SQLExtProcRaiseErrorWithMsg(ExtProcContext *Context,
int ErrorCode,
char *ErrorMessage);
Parameters
Context
Input
Context
ErrorCode
Input
Error code
ErrorMessage
Input
Error Message
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
HY000
General error.
HY001
Memory allocation error.
SQLFetch
Supported by ISO 92 CLI/ODBC 1.0. This function executes fetch for the execution result of an SQL statement, and returns data from all the selected columns. In other words, the function moves the cursor to the next row in the result set, and brings bound columns. If no column is bound, no data is returned to the application program, and only the cursor is moved to the next row. After the cursor is moved, unbound column data is deleted.
The SQLFetch function can be called only when the previously executed SQL statement is a SELECT statement.
Syntax
SQLRETURN SQLFetch (SQLHSTMT StatementHandle);
Parameters
StatementHandle
Input
Statement handle.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function is completed but related data cannot be found. (Ex: No row is updated by the given SQL statement)
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
01S01
Error in a row.
01S07
Part of information of numeric type or date type is truncated.
07006
Violation of limited data type property.
07009
Invalid descriptor index.
08S01
Failed to connect server for communication.
22001
Character string is truncated from the right.
22002
Indicator variable is required but not offered.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format.
22012
Divided by 0.
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution is not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY107
Tried to refer to a row number which does not exist in the result set.
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLFetch function.
SQLFetchScroll
Supported by ISO 92 CLI/ODBC 3.0. This function fetches a set of certain rows in the result set, and returns all the selected columns. The set of rows is inserted to either absolute or relative position.
Syntax
SQLRETURN SQLFetchScroll (SQLHSTMT StatementHandle,
SQLSMALLINT FetchOrientation,
SQLINTEGER FetchOffset);
Parameters
StatementHandle
Input
Statement handle
FetchOrientation
Input
Scroll type
SQL_FETCH_NEXT: The next row
SQL_FETCH_PRIOR: The previous row
SQL_FETCH_FIRST: The first row
SQL_FETCH_LAST: The last row
SQL_FETCH_ABSOLUTE: The FetchOffset th(st,nd,rd) row from the start point
SQL_FETCH_RELATIVE: The FetchOffset th(st, nd, rd) row from the current row
FetchOffset
Input
The row number to be fetched
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
01S01
Error in a row.
01S06
Tried to fetch before the result set returns the first row set.
01S07
Part of information of numeric type or date type is truncated.
07006
Violation of limited data type property
07009
Invalid descriptor index
08S01
Failed to connect server for communication.
22001
Character string is truncated from the right.
22002
Indicator variable is required but not offered.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format
22012
Divided by 0
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration
24000
Invalid cursor state
40001
Serialization failure
40003
The execution is not finished and the transaction state is unknown.
HY000
General error
HY001
Memory allocation error
HY008
Operation is canceled.
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HY106
Fetch type is out of range.
HY107
Tried to refer to a row number which does not exist in the result set.
HY111
Invalid bookmark value
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLFetchScroll function.
SQLForeignKeys
Supported by ISO 92 CLI/ODBC 1.0. This function searches the information about foreign keys of tables. In other words, the function searches the column of the table that refers to the primary key of other tables or the list of foreign keys that refer to the primary key of the table.
Syntax
SQLRETURN SQLForeignKeys (SQLHSTMT StatementHandle,
SQLCHAR *PKCatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *PKSchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *PKTableName,
SQLSMALLINT NameLength3,
SQLCHAR *FKCatalogName,
SQLSMALLINT NameLength4,
SQLCHAR *FKSchemaName,
SQLSMALLINT NameLength5,
SQLCHAR *FKTableName,
SQLSMALLINT NameLength6);
Parameters
StatementHandle
Input
Statement handle
PKCatalogName
Input
Primary key's catalog name
NameLength1
Input
Primary key's catalog name length
PKSchemaName
Input
Primary key's schema name
NameLength2
Input
Primary key's schema name length
PKTableName
Input
Primary key's table name
NameLength3
Input
Primary key's table name length
FKCatalogName
Input
Foreign key's catalog name
NameLength4
Input
Foreign key's catalog name length
FKSchemaName
Input
Foreign key's schema name
NameLength5
Input
Foreign key's schema name length
FKTableName
Input
Foreign key's table name
NameLength6
Input
Foreign key's table name length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
08S01
Failed to connect server for communication.
24000
Invalid cursor state
40001
Serialization failure
40003
The execution has not finished and the transaction state is unknown.
HY000
General error
HY001
Memory allocation error
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used. .
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HYC00
Optional feature is not implemented.
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLForeignKeys function.
SQLFreeConnect(Deprecated)
This function invalidates the connection handle, and cancels all related resources. If the SQLFreeConnect function is called when database connection is valid, SQL_ERROR is returned and the connection handle is validated.
Related Function SQLFreeConnect is replaced by SQLDisconnect in ODBC 3.x.
SQLFreeEnv(Deprecated)
This function invalidates the environment handle, and cancels all related resources. If the SQLFreeEnv function is called when the connection handle is valid, SQL_ERROR is returned and the environment handle is validated.
Before the function is called, the SQLFreeConnect function should be called.
Related Function SQLFreeEnv is replaced by SQLFreeHandle in ODBC 3.x.
SQLFreeHandle
Supported by ISO 92 CLI/ODBC 3.0. This function cancels the memories allocated to connection, handle, and command statement.
Syntax
SQLRETURN SQLFreeHandle (SQLSMALLINT HandleType,
SQLHANDLE Handle);
Parameters
HandleType
Input
Handle type to be canceled. Has one value among the following types.
SQL_HANDLE_ENV
SQL_HANDLE_DBC
SQL_HANDLE_STMT
Handle
Input
Handle to be canceled.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HY017
Automatically allocated descriptor handle is incorrectly used.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLFreeHandle function.
SQLFreeStmt
Supported by ISO 92 CLI/ODBC 1.0. This function cancels the memory allocated to a command statement.
After processing an SQL statement, call the SQLFreeStmt function. The function closes the open cursor and reconfigures the parameters. The function also cancels the binding of columns, invalidates the statement handle, and cancels handle related resources. Also, the method to cancel the handle can be configured by the option parameter.
Syntax
SQLRETURN SQLFreeStmt (SQLHSTMT StatementHandle,
SQLUSMALLINT Option);
Parameters
StatementHandle
Input
Statement handle
Option
Input
Method of canceling the handle
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HY092
Invalid property and option identifier
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLFreeStmt function.
SQLGetConnectAttr
Supported by ISO 92 CLI/ODBC 3.0. This function returns the properties of the currently configured database connection.
Syntax
SQLRETURN SQLGetConnectAttr (SQLHDBC ConnectionHandle,
SQLINTEGER Attribute,
SQLPOINTER Value,
SQLINTEGER BufferLength,
SQLINTEGER *StringLength);
Parameters
ConnectionHandle
Input
Connection handle
Attribute
Input
Column to be searched
Value
Output
Memory pointer that stores the current value of the column
BufferLength
Input
Buffer size that will store the execution result
StringLength
Output
Value parameter length
- In case of the NULL pointer, the length is not returned.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
08003
Database connection does not exist.
08S01
Failed to connect server for communication.
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HY092
Invalid property and option identifier
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetConnectAttr function.
SQLGetConnectOption(Deprecated)
The SQLGetConnectOption function is replaced by the SQLGetConnectAttr function in ODBC 3.x.
SQLGetCursorName
Supported by ISO 92 CLI/ODBC 1.0. This function returns the name of the cursor related to the specified statement.
Syntax
SQLRETURN SQLGetCursorName (SQLHSTMT StatementHandle,
SQLCHAR *CursorName,
SQLSMALLINT BufferLength,
SQLSMALLINT *NameLength);
Parameters
StatementHandle
Input
Statement handle
CursorName
Output
Buffer pointer that stores cursor name
BufferLength
Input
Buffer pointer that will store the execution result
NameLength
Output
Length of the cursor name
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HY015
No available cursor name
HY090
Invalid character string or buffer length
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetCursorName function.
SQLGetData
Supported by ISO 92 CLI/ODBC 1.0. This function searches data for a single column from the current row of the result set. This function can be used instead of the SQLBinCol function that calls the SQLFetch function to send data directly to application program variables.
Syntax
SQLRETURN SQLGetData (SQLHSTMT StatementHandle,
SQLUSMALLINT ColumnNumber,
SQLSMALLINT TargetType,
SQLPOINTER TargetValue,
SQLINTEGER BufferLength,
SQLINTEGER *StrLen_or_Ind);
Parameters
StatementHandle
Input
Statement handle
ColumnNumber
Input
Column position to be searched.
TargetType
Input
Buffer's C type to which the searched data will be inserted.
TargetValue
Output
Buffer pointer to which the searched data will be inserted.
BufferLength
Input
Buffer length
StrLen_or_Ind
Output
Length of indicator of the searched data
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_STILL_EXECUTING
Previously executed SQL statement is not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
01S07
Part of information of numeric type or date type is truncated.
07006
Violation of limited data type property
07009
Invalid descriptor index
08S01
Failed to connect server for communication.
22002
Indicator variable is required but not offered.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format
22012
Divided by 0
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration
24000
Invalid cursor state
HY000
General error
HY001
Memory allocation error
HY003
Invalid application buffer type
HY008
Operation canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HY109
Invalid cursor position
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetData function.
SQLGetDescField
Supported by ISO 92 CLI/ODBC 3.0. This function returns the column value or the currently configured settings of the descriptor record.
Syntax
SQLRETURN SQLGetDescField (SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber,
SQLSMALLINT FieldIdentifier,
SQLPOINTER Value,
SQLINTEGER BufferLength,
SQLINTEGER *StringLength);
Parameters
DescriptorHandle
Input
Descriptor handle
RecNumber
Input
Descriptor record
FieldIdentifier
Input
Descriptor value column
Value
Output
Buffer pointer that stores the descriptor information
BufferLength
Input
Buffer size that stores the descriptor information
StringLength
Output
The execution result information length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function is completed but related data cannot be found. (Ex: RecNumber Parameter is bigger than the current number of descriptor record.) Or the descriptor handle is IRD but the cursor does not open.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right
07009
Invalid descriptor index
08S01
Failed to connect server for communication
HY000
General error
HY001
Memory allocation error
HY007
SQL statement is not prepared
HY010
Function sequence error
HY013
Memory management error
HY021
Inconsistent descriptor information
HY090
Invalid character string or buffer length
HY091
Invalid descriptor field identifier
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetDescField function
SQLGetDescRec
Supported by ISO 92 CLI/ODBC 3.0. This function returns multiple column values or the currently configured settings of the descriptor record. The column returns the specified name, data type, column, and parameter data storage.
Syntax
SQLRETURN SQLGetDescRec (SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber,
SQLCHAR *Name,
SQLSMALLINT BufferLength,
SQLSMALLINT *StringLength,
SQLSMALLINT *Type,
SQLSMALLINT *SubType,
SQLINTEGER *Length,
SQLSMALLINT *Precision,
SQLSMALLINT *Scale,
SQLSMALLINT *Nullable);
Parameters
DescriptorHandle
Input
Descriptor handle
RecNumber
Input
Descriptor record
Name
Output
Buffer pointer that stores column SQL_DESC_NAME
BufferLength
Input
Name Parameter's buffer length
StringLength
Output
The length of returned SQL_DESC_NAME column
Type
Output
Buffer pointer that stores column SQL_DESC_TYPE
SubType
Output
Buffer pointer to which the SQL_DESC_DATETIME_INTERVAL_CODE field value will be
returned for SQL_DATETIME type record.
Length
Output
Descriptor record length information
Precision
Output
Descriptor record precision information
Scale
Output
Descriptor record scale information
Nullable
Output
Information about whether to allow NULL for descriptor record
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function is completed but related data cannot be found. (Ex: RecNumber Parameter is bigger than the current number of descriptor record.) Or the descriptor handle is IRD but the cursor does not open.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
07009
Invalid descriptor index
08S01
Failed to connect server for communication.
HY000
General error
HY001
Memory allocation error
HY007
SQL statement is not prepared.
HY010
Function sequence error
HY013
Memory management error
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetDescRec function.
SQLGetDiagField
Supported by ISO 92 CLI/ODBC 3.0. This function returns a current value of a field in the diagnostic data structure containing state information, error, and warning related a specific handle.
Syntax
SQLRETURN SQLGetDiagField (SQLSMALLINT HandleType,
SQLHANDLE Handle,
SQLSMALLINT RecNumber,
SQLSMALLINT DiagIdentifier,
SQLPOINTER DiagInfo,
SQLSMALLINT BufferLength,
SQLSMALLINT *StringLength);
Parameters
HandleType
Input
Handle type
Handle
Input
Handle
RecNumber
Input
State record
DiagIdentifier
Input
Diagnostic column of the value to be returned
DiagInfo
Output
Buffer pointer that stores Diagnostic information
BufferLength
Input
Buffer length
StringLength
Output
The execution result information length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
HY009
NULL pointer is incorrectly used.
HY001
Memory allocation error
SQLGetDiagRec
Supported by ISO 92 CLI/ODBC 3.0. This function returns a current value of a field in the diagnostic data structure containing; state information, error, and warning related a specific handle. Unlike the SQLGetDiagField function that returns only a single column, the function returns SQLSATE, error code, diagnostic message text, etc.
Syntax
SQLRETURN SQLGetDiagRec (SQLSMALLINT HandleType,
SQLHANDLE Handle,
SQLSMALLINT RecNumber,
SQLCHAR *Sqlstate,
SQLINTEGER *NativeError,
SQLCHAR *MessageText,
SQLSMALLINT BufferLength,
SQLSMALLINT *TextLength);
Parameters
HandleType
Input
Handle type
Handle
Input
Handle
RecNumber
Input
State record
Sqlstate
Output
SQLSTATE code
NativeError
Output
Default error code
MessageText
Output
Text string of a diagnostic message
BufferLength
Input
Buffer length to store text string of a diagnostic message
TextLength
Output
Length of text string of a diagnostic message
Return Code
SQL_SUCCESS
Function is finished successfully.
SQL_SUCCESS_WITH_INFO
Function is successfully finished but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Function is completed but related data cannot be found. (Ex: RecNumber Parameter is 0 or negative number.) Or, buffer length is smaller than 0.
SQLSTATE
HY009
NULL pointer is incorrectly used.
HY001
Memory allocation error
SQLGetEnvAttr
Supported by ISO 92 CLI/ODBC 3.0. This function returns the current value of a column that is related to the environment handle.
Syntax
SQLRETURN SQLGetEnvAttr (SQLHENV EnvironmentHandle,
SQLINTEGER Attribute,
SQLPOINTER Value,
SQLINTEGER BufferLength,
SQLINTEGER *StringLength);
Parameters
EnvironmentHandle
Input
Environment handle
Attribute
Input
Column to be searched.
Value
Output
Current value of column
BufferLength
Input
The maximum length if a value parameter is a character string.
StringLength
Output
The execution result information length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
HY000
General error
HY001
Memory allocation error
HY013
Memory management error
HY092
Invalid property and option identifier
HYC00
Optional feature is not implemented.
IM001
Driver does not support the SQLGetEnvAttr function.
SQLGetExtProcAllocMemory
Supported for the external procedure module, this function allocates a statement handle using the context of the extproc.
Syntax
SQLPOINTER SQL_API SQLExtProcAllocMemory(ExtProcContext *Context,
SQLUINTEGER AllocSize);
Parameters
Context
Input
Context
AllocSize
Input
Allocation size
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
HY000
General error
HY001
Memory allocation error
SQLGetExtProcConnect
Supported for the external procedure module, this function allocates environment variables and connections using the context and connect of the extproc.
Syntax
SQLRETURN SQL_API SQLGetExtProcConnect(ExtProcContext *Context,
SQLHENV *EnvironmentHandle,
SQLHDBC *ConnectionHandle,
SQLSMALLINT *ErrorHandleType,
SQLHANDLE *ErrorHandle);
Parameters
Context
Input
Context
EnvironmentHandle
Input
Environment handle
ConnectionHandle
Output
Connection handle
ErrorHandleType
Output
Error handle type
ErrorHandle
Output
Error handle
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
HY000
General error
HY001
Memory allocation error
SQLGetFunctions
Supported by ISO 92 CLI/ODBC 1.0. This function is used to know whether a driver supports a certain function. The function can be used both in the driver manager and the driver. If the function is used within a driver, driver manager calls functions within the driver.
Syntax
SQLRETURN SQLGetFunctions (SQLHDBC ConnectionHandle,
SQLUSMALLINT FunctionId,
SQLUSMALLINT *Supported);
Parameters
ConnectionHandle
Input
Connection handle
FunctionId
Input
Defined value which will call a ODBC function
Supported
Output
Buffer pointer that will store the information whether the requested function is supported.
SQL_TRUE
SQL_FALSE
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
08S01
Failed to connect to server for communication.
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HY095
Function out of range
HYT01
Database connection time limit exceeded.
SQLGetInfo
Supported by ISO 92 CLI/ODBC 1.0. This function returns general information about a datasource related to driver connection.
Syntax
SQLRETURN SQLGetInfo (SQLHDBC ConnectionHandle,
SQLUSMALLINT InfoType,
SQLPOINTER InfoValue,
SQLSMALLINT BufferLength,
SQLSMALLINT *StringLength);
Parameters
ConnectionHandle
Input
Connection handle
InfoType
Input
Information type
InfoValue
Output
Buffer pointer to store information
BufferLength
Input
Buffer length
StringLength
Output
Returned information length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
08003
Database connection does not exist.
08S01
Failed to connect server for communication.
HY000
General error
HY001
Memory allocation error
HY013
Memory management error
HY024
Invalid property value
HY090
Invalid character string or buffer length
HY096
Information type out of range
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetInfo function.
SQLGetStmtAttr
Supported by ISO 92 CLI/ODBC 3.0. This function returns the current value of SQL statement properties.
Syntax
SQLRETURN SQLGetStmtAttr (SQLHSTMT StatementHandle,
SQLINTEGER Attribute,
SQLPOINTER Value,
SQLINTEGER BufferLength,
SQLINTEGER *StringLength);
Parameters
StatementHandle
Input
Statement handle
Attribute
Input
Property to be searched
Value
Output
Buffer pointer to which the current value of the specified property will
be returned
BufferLength
Input
Buffer length
StringLength
Output
Returned result length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01004
Character string is truncated from the right.
24000
Invalid cursor state
HY000
General error
HY001
Memory allocation error
HY010
Function sequence error
HY013
Memory management error
HY090
Invalid character string or buffer length
HY092
Invalid property and option identifier
HY109
Invalid cursor position
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetStmtAttr function.
SQLGetStmtOption(Deprecated)
The SQLGetStmtOption function is replaced by the SQLGetStmtAttr function in ODBC 3.x.
SQLGetTypeInfo
Supported by ISO 92 CLI/ODBC 1.0. This function returns the information of data types supported by a datasource. The information is returned as a result set of an SQL statement execution.
If the function is called in ALTER TABLE or CREATE TABLE statements, application program uses the name of type that is returned as TYPE_NAME column of result set.
Syntax
SQLRETURN SQLGetTypeInfo (SQLHSTM StatementHandle,
SQLSMALLINT DataType);
Parameters
StatementHandle
Input
Statement handle
DataType
Input
SQL data type
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01S02
Option value has changed.
08S01
Failed to connect to server for communication
24000
Invalid cursor state
40001
Serialization failure
40003
The execution has not finished and the transaction state is unknown.
HY000
General error
HY001
Memory allocation error
HY004
Invalid SQL data type
HY008
Operation is canceled.
HY010
Function sequence error
HY013
Memory management error
HYC00
Optional feature is not implemented.
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLGetTypeInfo function.
SQLMoreResults
Supported by ISO 92 CLI/ODBC 1.0. This function decides whether an SQL statement, which includes SELECT, UPDATE, INSERT, and DELETE statements, additionally uses the execution result. If the execution result is additionally used, the function initializes the result.
Syntax
SQLRETURN SQLMoreResults(SQLHSTMT StatementHandle);
Parameters
StatementHandle
Input
Statement handle
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning
01S02
Option value has changed.
08S01
Failed to connect server for communication.
40001
Serialization failure
40003
The execution has not finished and the transaction state is unknown.
HY000
General error
HY001
Memory allocation error
HY008
Operation is canceled.
HY010
Function sequence error
HY013
Memory management error
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLMoreResults function.
SQLNativeSql
Supported by ODBC 1.0. This function returns SQL character string that is changed by the driver. The SQL statement is not executed.
Syntax
SQLRETURN SQLNativeSql (SQLHDBC ConnectionHandle,
SQLCHAR *InStatementText,
SQLINTEGER TextLength1,
SQLCHAR *OutStatementText,
SQLINTEGER BufferLength,
SQLINTEGER *TextLength2Ptr);
Parameters
ConnectionHandle
Input
Connection handle
InStatementText
Input
SQL character string to be changed
TextLength1
Input
SQL character string length to be changed
OutStatementText
Output
Returned SQL character string
BufferLength
Input
Buffer length to store a returned SQL character string
TextLength2Ptr
Output
Length of a returned result
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
08003
Database connection does not exist.
08S01
Failed to connect server for communication.
22007
Invalid DATETIME type format.
24000
Invalid cursor state.
HY000
General error.
HY001
Memory allocation error.
HY009
NULL pointer is incorrectly used.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY109
Invalid cursor position.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLNativeSql function.
SQLNumParams
Supported by ODBC 1.0. This function returns the number of parameters within an SQL statement.
Syntax
SQLRETURN SQLNumParams (SQLHSTMT StatementHandle,
SQLSMALLINT *ParameterCountPtr);
Parameters
StatementHandle
Input
Statement handle.
ParameterCountPtr
Output
Buffer pointer to store the return information.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLNumParams function.
SQLNumResultCols
Supported by ISO 92 CLI/ODBC 1.0. This function returns the number of columns of a result set related to an input statement handle. If the recently executed SQL statement is not a SELECT statement, the function returns 0.
Before the function is called, SQLPrepare or SQLExecDirect function should be called.
Syntax
SQLRETURN SQLNumResultCols (SQLHSTMT StatementHandle,
SQLSMALLINT *ColumnCount);
Parameters
StatementHandle
Input
Statement handle.
ColumnCount
Output
Pointer to store the result.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLNumResultCols function.
SQLParamData
Supported by ISO 92 CLI/ODBC 1.0. This function supports parameter data when executing an SQL statement. This function is used along with the SQLPutData function.
Syntax
SQLRETURN SQLParamData (SQLHSTMT StatementHandle,
SQLPOINTER *Value);
Parameters
StatementHandle
Input
Statement handle
Value
Output
Buffer pointer to store the ParameterValue parameter of the
SQLBindParameter function, or the TargetValue parameter of the
SQLBindCol function.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
Invalid handle given to input parameter.
SQL_NEED_DATA
More data is required to execute the SQL statement. (Ex: Parameter)
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
07006
Violation of limited data type property.
08S01
Failed to connect server for communication.
22026
Character string data with invalid length.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLParamData function.
SQLParamOptions(Deprecated)
The SQLParamOptions function is replaced by the SQLSetStmtAttr function in ODBC 3.x.
SQLPrepare
Supported by ISO 92 CLI/ODBC 1.0. This function prepares the SQL statements to be executed. In other words, the function connects an SQL statement with an input command handle, and sends the command to the database to be prepared.
Syntax
SQLRETURN SQLPrepare (SQLHSTMT StatementHandle,
SQLCHAR *StatementText,
SQLINTEGER TextLength);
Parameters
StatementHandle
Input
Statement handle
StatementText
Input
SQL statement
TextLength
Input
SQL statement length
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01S02
Option value is changed.
08S01
Failed to connect server for communication.
21S01
The list to be inserted and the columns do not match.
21S02
Table's degree and column do not match.
22018
Invalid character value for cast configuration.
22019
Invalid escape character.
22025
Invalid escape sequence.
24000
Invalid cursor state.
34000
Invalid cursor name.
3D000
Invalid catalog name.
3F000
Invalid schema name.
42000
Syntax error or access violation occurred.
42S01
Base table or view already exists.
42S02
Unable to find the base table or view.
42S11
Index already exists.
42S12
Unable to find the index.
42S21
Column already exists.
42S22
Unable to find the column.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLPrepare function.
SQLPrimaryKeys
Supported by ISO 92 CLI/ODBC 1.0. This function returns the information about the primary key of a certain table, as a list.
Syntax
SQLRETURN SQLPrimaryKeys (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *TableName,
SQLSMALLINT NameLength3);
Parameters
StatementHandle
Input
Statement handle.
CatalogName
Input
Catalog name.
NameLength1
Input
Catalog name length.
SchemaName
Input
Schema name.
NameLength2
Input
Schema name length.
TableName
Input
Table name.
NameLength3
Input
Table name length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
HYT00
Limit time exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLPrimaryKeys function.
SQLProcedureColumns
Supported by ODBC 1.0. This function returns not only the columns that compose specified procedure result set but also the list of input/output parameters. They are returned as a result set of specified statements.
Syntax
SQLRETURN SQLProcedureColumns (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *ProcName,
SQLSMALLINT NameLength3,
SQLCHAR *ColumnName,
SQLSMALLINT NameLength4);
Parameters
StatementHandle
Input
Statement handle.
CatalogName
Input
Catalog name.
NameLength1
Input
Catalog name length.
SchemaName
Input
Schema name.
NameLength2
Input
Schema name length.
ProcName
Input
Procedure name.
NameLength3
Input
Procedure name length.
ColumnName
Input
Column name.
NameLength4
Input
Column name length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
HY000
General error
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLProcedureColumns function.
SQLProcedures
Supported by ODBC 1.0. This function returns the list of procedure names stored in the specified datasource.
Syntax
SQLRETURN SQLProcedures (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *ProcName,
SQLSMALLINT NameLength3);
Parameters
StatementHandle
Input
Statement handle.
CatalogName
Input
Catalog name.
NameLength1
Input
Catalog name length.
SchemaName
Input
Schema name.
NameLength2
Input
Schema name length.
ProcName
Input
Procedure name.
NameLength3
Input
Procedure name length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
HYT00
Limit time exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLProcedures function.
SQLPutData
Supported by ISO 92 CLI/ODBC 1.0. This function allows parameter or column data to be sent to the driver when the application program executes an SQL statement. The function is used to send character or binary data values to a column that has the data type used in a character, binary or a certain datasource.
The function supports the unicode C data type to be bound, even when the current driver does not support the unicode data.
Syntax
SQLRETURN SQLPutData (SQLHSTMT StatementHandle,
SQLPOINTER Data,
SQLINTEGER StrLen_or_Ind);
Parameters
StatementHandle
Input
Statement handle.
Data
Input
Buffer pointer to store actual data of parameter or column.
StrLen_or_Ind
Input
Data length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
07006
Violation of limited data type property.
07S01
Default parameter is incorrectly used.
08S01
Failed to connect server for communication.
22001
Character string is truncated from the right.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format.
22008
Overflow occurred to the DATETIME field.
22012
Divided by 0.
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY019
Data that is neither character nor binary was sent by being divided.
HY020
Tried on union of NULL value.
HY090
Invalid character string or buffer length.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLPutData function.
SQLRowCount
Supported by ISO 92 CLI/ODBC 1.0. This function returns the number of rows of tables which were affected by UPDATE, INSERT, and DELETE statements, or views related to the tables. The function returns 0 if the recently executed SQL statement is not an UPDATE, INSERT, or DELETE statement, or the execution has failed.
Before the function is executed, the SQLExecute function or the SQLExecDirect function should be called.
Syntax
SQLRETURN SQLRowCount (SQLHSTMT StatementHandle,
SQINTEGER *RowCount);
Parameters
StatementHandle
Input
Statement handle.
RowCount
Output
Pointer to store the rows of execution result.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLRowCount function.
SQLSetConnectAttr
Supported by ISO 92 CLI/ODBC 3.0. This function configures the connection property values for a certain database connection. All the configured database connections and command options are kept until the SQLFreeConnect function is called or they are reconfigured by the SQLSetConnectAttr function.
Syntax
SQLRETURN SQLSetConnectAttr (SQLHDBC ConnectionHandle,
SQLINTEGER Attribute,
SQLPOINTER Value,
SQLINTEGER StringLength);
Parameters
ConnectionHandle
Input
Connection handle.
Attribute
Input
Properties to be configured.
Value
Input
Buffer pointer that contains the property values to be configured.
StringLength
Input
Buffer length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01S02
Option value is changed.
08002
The database connection name is already used.
08003
Database connection does not exist.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
3D000
Invalid catalog name.
HY000
General error.
HY001
Memory allocation error.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY011
The property cannot be currently configured.
HY013
Memory management error.
HY024
Invalid property value.
HY090
Invalid character string or buffer length.
HY092
Invalid property and option identifier.
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLSetConnectAttr function.
IM009
Unable to load translation DDL.
SQLSetConnectOption(Deprecated)
The SQLSetConnectOption function is replaced by the SQLSetConnectAttr function in ODBC 3.x.
SQLSetCursorName
Supported by ISO 92 CLI/ODBC 1.0. This function relates the currently executing SQL statement with a cursor name. If the application program does not call the function, the driver creates a cursor name required to execute the SQL statement.
Syntax
SQLRETURN SQLSetCursorName (SQLHSTMT StatementHandle,
SQLCHAR *CursorName,
SQLSMALLINT NameLength);
Parameters
StatementHandle
Input
Statement handle.
CursorName
Input
Cursor name.
NameLength
Input
Cursor name length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
24000
Invalid cursor state.
34000
Invalid cursor name.
3C000
Duplicated cursor name.
HY000
General error.
HY001
Memory allocation error.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLSetCursorName function.
SQLSetDescField
Supported by ISO 92 CLI/ODBC 3.0. This function configures a field value of a descriptor record.
Syntax
SQLRETURN SQLSetDescField (SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber,
SQLSMALLINT FieldIdentifier,
SQLPOINTER Value,
SQLINTEGER BufferLength);
Parameters
DescriptorHandle
Input
Descriptor handle.
RecNumber
Input
The field record number in the descriptor. (Record number starts from 1.)
FieldIdentifier
Input
Field identifier to be configured.
Value
Input
Buffer pointer which stores the value to be configured.
BufferLength
Input
Buffer length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01S02
Option value is changed.
07009
Invalid descriptor index.
08S01
Failed to connect server for communication.
22001
Character string is truncated from the right.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HY016
Implementation row descriptor cannot be edited.
HY021
Inconsistent descriptor information.
HY090
Invalid character string or buffer length.
HY091
Invalid descriptor field identifier.
HY092
Invalid property and option identifier.
HY105
Invalid parameter type.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLSetDescField function.
SQLSetDescRec
Supported by ISO 92 CLI/ODBC 3.0. This function configures multiple descriptor columns for a buffer and data types that are used in a column or parameter data.
Syntax
SQLRETURN SQLSetDescRec (SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber,
SQLSMALLINT Type,
SQLSMALLINT SubType,
SQLINTEGER Length,
SQLSMALLINT Precision,
SQLSMALLINT Scale,
SQLPOINTER Data,
SQLINTEGER *StringLength,
SQLINTEGER *Indicator);
Parameters
DescriptorHandle
Input
Descriptor handle.
RecNumber
Input
Descriptor record that includes the columns to be configured.
Type
Input
Descriptor record types.
SubType
Input
Descriptor record sub types.
Length
Input
Descriptor record's length column.
Precision
Input
Descriptor record's precision column.
Scale
Input
Descriptor record's scale column.
Data
In/output
Descriptor record's data pointer column.
StringLength
In/output
Descriptor record's character string length column.
Indicator
In/output
Descriptor record's indicator pointer column.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
07009
Invalid descriptor index.
08S01
Failed to connect server for communication.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HY016
Implementation row descriptor cannot be edited.
HY021
Inconsistent descriptor information.
HY090
Invalid character string or buffer length.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLSetDescRec function.
SQLSetEnvAttr
Supported by ISO 92 CLI/ODBC 3.0. This function configures property values of the current environment handle.
Syntax
SQLRETURN SQLSetEnvAttr (SQLHENV EnvironmentHandle,
SQLINTEGER Attribute,
SQLPOINTER Value,
SQLINTEGER StringLength);
Parameters
EnvironmentHandle
Input
Environment handle.
Attribute
Input
Environment handle property to be configured.
Value
Input
Environment handle property value to be configured.
StringLength
Input
The length if the environment handles property value to be configured,
is a string.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01S02
Option value is changed.
HY000
General error.
HY001
Memory allocation error.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY024
Invalid property value.
HY090
Invalid character string or buffer length.
HY092
Invalid property and option identifier.
HYC00
Optional feature is not implemented.
SQLSetParam(Deprecated)
The SQLSetParam function is replaced by the SQLBindParameter function in ODBC 3.x.
SQLSetPos
Supported by ODBC 1.0. This function configures the cursor position or allows application program to refresh data within a row set. The function can also update or delete the data in the result set.
Syntax
SQLRETURN SQLSetPos (SQLHSTMT StatementHandle,
SQLUSMALLINT RowNumber,
SQLUSMALLINT Operation,
SQLUSMALLINT LockType);
Parameters
StatementHandle
Input
Statement handle.
RowNumber
Input
Row position in the row set.
Operation
Input
Operations to be executed.
LockType
Input
Lock types for rows after operation is executed.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_NEED_DATA
More data is required to execute the SQL statement. (Ex: Parameter)
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01001
Cursor operation is conflicted.
01004
Character string is truncated from the right.
01S01
Error in a row.
01S07
The fractional part of the number of a numeric type or date type is
truncated.
07006
Violation of limited data type property.
07009
Invalid descriptor index.
21S02
Table's degree and column do not match.
22001
Character string is truncated from the right.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format.
22008
Overflow occurred to the DATETIME field.
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration.
23000
Violation of integrity constraint.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
42000
Syntax error or access violation occurred.
44000
Violation of WITH CHECK OPTION.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY010
Function sequence error.
HY011
The property cannot be configured currently.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY092
Invalid property identifier.
HY107
Tried to refer to a row number which does not exist in the result set.
HY109
Invalid cursor position.
HYC00
Optional feature is not implemented.
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLSetPos function.
SQLSetScrollOptions(Deprecated)
The SQLSetScrollOptions function is replaced by the SQLGetInfo function and the SQLSetStmtAttr.
SQLSetStmtAttr
Supported by ISO 92 CLI/ODBC 3.0. This function configures properties of a certain statement handle. Unless the properties are reconfigured by a new SQLSetStmtAttr function or the statement handle is deleted, the configured properties remain.
Syntax
SQLRETURN SQLSetStmtAttr (SQLHSTMT StatementHandle,
SQLINTEGER Attribute,
SQLPOINTER Value,
SQLINTEGER StringLength);
Parameters
StatementHandle
Input
Statement handle.
Attribute
Input
Statement handle property to be configured.
Value
Input
Statement handle property value to be configured.
StringLength
Input
The length, if the statement handle property value to be configured is
a string
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to the input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01S02
Option value is changed.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
HY000
General error.
HY001
Memory allocation error.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY011
The property cannot be configured currently.
HY013
Memory management error.
HY017
Automatically allocated descriptor handle is incorrectly used.
HY024
Invalid property value.
HY090
Invalid character string or buffer length.
HY092
Invalid property and option identifier.
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLSetStmtAttr function.
SQLSetStmtOption(Deprecated)
The SQLSetStmtOption function is replaced by the SQLSetStmtAttr function in ODBC 3.x.
SQLSpecialColumns
Supported by Xopen CLI/ISO 92 CLI/ODBC 1.0. This function searches information of a certain column in a table.
The searched column information includes the optimal set of columns that configure only a single row in the table, and the automatically changed columns when a transaction changes a value of a row.
Syntax
SQLRETURN SQLSpecialColumns (SQLHSTMT StatementHandle,
SQLUSMALLINT IdentifierType,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *TableName,
SQLSMALLINT NameLength3,
SQLUSMALLINT Scope,
SQLUSMALLINT Nullable);
Parameters
StatementHandle
Input
Statement handle.
IdentifierType
Input
Column type to be returned.
CatalogName
Input
Catalog name.
NameLength1
Input
Catalog name length.
SchemaName
Input
Schema name.
NameLength2
Input
Schema name length.
TableName
Input
Table name.
NameLength3
Input
Table name length.
Scope
Input
Minimum range of ROWID.
Nullable
Input
Whether to allow NULL value
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY097
The column is out of range.
HY098
The type is out of scope.
HY099
Nullable type out of range.
HYC00
Optional feature is not implemented.
HYT00
Limit time exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLSpecialColumns function.
SQLStatistics
Supported by Xopen CLI/ODBC 1.0. This function returns index statistics of a certain table. The information is returned as a result set.
Syntax
SQLRETURN SQLStatistics (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *TableName,
SQLSMALLINT NameLength3,
SQLUSMALLINT Unique,
SQLUSMALLINT Reserved);
Parameters
StatementHandle
Input
Statement handle.
CatalogName
Input
Catalog name.
NameLength1
Input
Catalog name length.
SchemaName
Input
Schema name.
NameLength2
Input
Schema name length.
TableName
Input
Table name.
NameLength3
Input
Table name length.
Unique
Input
Index types.
Reserved
Input
If set to SQL_EMSURE, brings the statistics information from database, unconditionally. Cannot be used under any other condition.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
1000
General warning.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY100
Uniqueness option type out of range..
HY101
Accuracy option type out of range.
HYC00
Optional feature is not implemented.
HYT00
Limit time exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLStatistics function.
SQLTablePrivileges
Supported by ISO 92 CLI/ODBC 1.0. This function returns information about related tables or an authority list for each table. The information is returned as a result set.
Syntax
SQLRETURN SQLTablePrivileges (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *TableName,
SQLSMALLINT NameLength3);
Parameters
StatementHandle
Input
Statement handle.
CatalogName
Input
Catalog name.
NameLength1
Input
Catalog name length.
SchemaName
Input
Schema name.
NameLength2
Input
Schema name length.
TableName
Input
Table name.
NameLength3
Input
Table name length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution has not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
HYT00
Limit time exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLTablePrivileges function.
SQLTables
Supported by Xopen CLI/ISO 92 CLI/ODBC 1.0. This function returns information about the list of table names, stored in the data dictionary, of a connected certain datasource. The information is returned as a result set and used like a result set generated from a SELECT statement.
Syntax
SQLRETURN SQLTables (SQLHSTMT StatementHandle,
SQLCHAR *CatalogName,
SQLSMALLINT NameLength1,
SQLCHAR *SchemaName,
SQLSMALLINT NameLength2,
SQLCHAR *TableName,
SQLSMALLINT NameLength3,
SQLCHAR *TableType,
SQLSMALLINT NameLength4);
Parameters
StatementHandle
Input
Statement handle.
CatalogName
Input
Catalog name.
NameLength1
Input
Catalog name length.
SchemaName
Input
Schema name.
NameLength2
Input
Schema name length.
TableName
Input
Table name.
NameLength3
Input
Table name length.
TableType
Input
Table's data type.
NameLength4
Input
Table's data type length.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08S01
Failed to connect server for communication.
24000
Invalid cursor state.
40001
Serialization failure.
40003
The execution is not finished and the transaction state is unknown.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
HYT00
Timeout exceeded.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLTables function.
SQLTransact(Deprecated)
This function commits or rolls back all the changes made in the database. If a transaction is used, the application program should call the function before the database is disconnected.
If the function is called, the open cursor is closed and the unprocessed result set is deleted.
Related Function SQLTransact is replaced by SQLEndTran in ODBC 3.x.
Tibero API
SQLAllocEnv2(Deprecated)
Like the SQLAllocEnv function, this function allocates and initializes the memory related to the environment handle. The function can configure whether an application program, which uses tbCLI, uses multi threads.
Multi threads configuration differs depending on the operating system.
UNIX line
UNIX line is set not to use multi threads by default. In order to use multi threads, you
must set the last parameter UseMultiThread to 'TRUE'.
Windows line
Multi threads can be used regardless of the UseMultiThread value, therefore it is recommended the SQLAllocEnv2 function or the SQLAllocHandle2 functions are not used.
This function should be used when allocating an environment handle firstly to configure whether to allow the use of multi threads.
Related Function SQLAllocEnv2 is replaced by SQLAllocHandle2.
SQLAllocHandle2
This function allocates environment, connection, and statement handles, and configures whether to allow a program using tbCLI to use multi threads. The methods of configuring multi threads, by operating systems, are the same with that of the SQLAllocHandle function.
Details of the SQLAllocHandle2 function are as follows:
Syntax
SQLRETURN SQLAllocHandle (SQLSMALLINT HandleType,
SQLHANDLE InputHandle,
SQLHANDLE *OutputHandle,
SQLSMALLINT UseMultiThread);
Parameters
HandleType
Input
Handle type to be allocated. Has one value among the following types.
SQL_HANDLE_ENV
SQL_HANDLE_DBC
SQL_HANDLE_STMT
InputHandle
Input
Input handle. Has a different value depending on the Handle type.
SQL_HANDLE_ENV: SQL_NULL_HANDLE
SQL_HANDLE_DBC: Environment handle
SQL_HANDLE_STMT: Connection handle
OutputHandle
Output
Pointer of the handle to be allocated. When allocating a different handle instead of the environment handle, if SQL_ERROR is returned, this option allocates an OutputHandle parameter as SQL_NULL_HDBC or SQL_NULL_HSTMT.
UseMultiThread
Input
Decides whether to use multi threads. When tbCLI is used in a multi-threads environment, set this value to SQL_TRUE.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
08003
Database connection does not exist.
HY000
General error.
HY001
Memory allocation error.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY014
The number of handles exceeds the limited range.
HY092
Invalid property and option identifier.
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLAllocHandle2 handle.
Related Fuction SQLAllocHandle2 replaces SQLAllocConnect, SQLAllocEnv2, and SQLAllocstmt.
SQLGetWarningMsg
This function searches the warning message that was issued for a SQL statement.
Syntax
SQLRETURN SQLGetWarningMsg (SQLHSTMT StatementHandle,
SQLCHAR *OutputString,
SQLINTEGER *BufLength);
Parameters
StatementHandle
Input
Statement handle
OutputString
Output
Buffer to contain the warning message to be returned.
BufLength
Input
Length of the buffer to contain the warning message to be returned.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_ERROR
Critical error occurred.
SQLGetWarningMsgLength
This function searches the length of the warning message that was issued for a specific SQL statement.
Syntax
SQLRETURN SQLGetWarningMsgLength (SQLHSTMT StatementHandle,
SQLINTEGER *Length);
Parameters
StatementHandle
Input
Statement handle
Length
Output
Length of the message to be returned.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_ERROR
Critical error occurred.
SQLLobClose
This function closes the operation target LOB. If the target LOB is not closed before the transaction is completed, an error occurs. An error also occurs when trying to close an unopened LOB.
If an LOB related function is called without calling open and close, every function internally executes open or close.
Syntax
SQLRETURN SQLLobClose (SQLHSTMT StatementHandle,
SQLINTEGER Locator,
SQLINTEGER *Indicator);
Parameters
StatementHandle
Input
Statement handle.
Locator
Input
LOB locator.
Indicator
Input
NULL indicator pointer.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLLobClose function.
SQLLobFreeLoc
This function frees the resources used by the operation target LOB locator.
Syntax
SQLRETURN SQLLobFreeLoc (SQLHSTMT StatementHandle,
SQLINTEGER Locator);
Parameters
StatementHandle
Input
Statement handle.
Locator
Input
LOB locator.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLLobClose function.
SQLLobGetData(Deprecated)
Retrieves LOB object data from a specified place. The retrieved data varies depending on BLOB and CLOB.
Syntax
SQLRETURN SQLLobGetData (SQLHSTMT StatementHandle,
SQLINTEGER SourceLocator,
SQLBIGINT Offset,
SQLINTEGER *ByteLength,
SQLINTEGER *CharLength,
SQLSMALLINT TargetCType,
SQLPOINTER Data,
SQLINTEGER BufferLength,
SQLINTEGER *Indicator);
Parameters
StatementHandle
Input
Statement handle.
SourceLocator
Input
LOB locator.
Offset
Input
Starting offset of the LOB data to be retrieved.
– CLOB, NCLOB: The starting character position.
– BLOB: The starting byte position.
ByteLength
Input/Output
BLOB type data length to be requested or returned.
CharLength
Input/Output
CLOB type data length to be requested or returned.
TargetCType
Input
C type of the data to be returned
Data
Input
Data pointer to be returned.
BufferLength
Input
Data buffer length to be returned.
Indicator
Output
Number of bytes written to data.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General Warning
01004
Character string is truncated from the right.
01S07
Part of information of numeric type or date type is truncated.
07006
Violation of limited data type property.
07009
Invalid descriptor index.
08S01
Failed to connect server for communication.
22002
Indicator variable is required but not offered.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format.
22012
Divided by 0.
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration.
24000
Invalid cursor state.
HY000
General error.
HY001
Memory allocation error.
HY003
Invalid application buffer type.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY109
Invalid cursor position.
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLLobGetData function.
Related Function SQLLobGetData is replaced by SQLLobGetData2.
SQLLobGetData2
Retrieves LOB object data from a specified location. The retrieved data varies depending on BLOB and CLOB.
Syntax
SQLRETURN SQLLobGetData2 (SQLHSTMT StatementHandle,
SQLINTEGER Locator,
SQLBIGINT Offset,
SQLINTEGER *ReadLength,
SQLSMALLINT TargetCType,
SQLPOINTER DataPtr,
SQLINTEGER BufferLength,
SQLINTEGER *Indicator);
Parameters
StatementHandle
Input
Statement handle.
Locator
Input
LOB locator
Offset
Input
Starting offset of the LOB data to be retrieved.
CLOB, NCLOB: The starting character position.
BLOB: The starting byte position.
ReadLength
Input/Output
Input
CLOB, NCLOB: The starting character position.
BLOB: Length of the data to be retrieved (in bytes).
Output
CLOB, NCLOB: Length of the data retrieved.
BLOB: Length of the data retrieved (in bytes).
If set to 0, 'BufferLength' number of bytes are filled.
TargetCType
Input
C type of the data to be returned
DataPtr
Input
Data pointer to be returned.
BufferLength
Input
Data buffer length to be returned.
Indicator
Output
Number of bytes written to data.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_NO_DATA
Function has completed, but related data cannot be found. (Ex: No row is updated by the given SQL statement.)
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
01S07
Part of information of numeric type or date type is truncated.
07006
Violation of limited data type property.
07009
Invalid descriptor index.
08S01
Failed to connect server for communication.
22002
Indicator variable is required but not offered.
22003
The numeric value is out of range.
22007
Invalid DATETIME type format.
22012
Divided by 0.
22015
Overflow occurred to the INTERVAL field.
22018
Invalid character value for cast configuration.
24000
Invalid cursor state.
HY000
General error.
HY001
Memory allocation error.
HY003
Invalid application buffer type.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY090
Invalid character string or buffer length.
HY109
Invalid cursor position.
HYC00
Optional feature is not implemented.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLLobGetData function.
SQLLobGetLength
This function searches the length of specified LOB data. The function can be used for both BLOB and CLOB type data.
Syntax
SQLRETURN SQLLobGetLength (SQLHSTMT StatementHandle,
SQLINTEGER Locator,
SQLBIGINT *StringLength,
SQLINTEGER *Indicator);
Parameters
StatementHandle
Input
Statement handle.
Locator
Input
LOB locator
StringLength
Output
Length of LOB data to be returned.
CLOB/NCLOB: Character length
BLOB: Byte length
Indicator
Input
NULL indicator pointer.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
07006
Violation of a limited data type property.
08S01
Failed to connect server for communication.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY019
Data that is neither character nor binary was sent by being divided.
HY020
Tried to connect NULL value.
HY090
Invalid character string or buffer length.
HYC00
Optional feature is not implemented.
0F001
No value on a LOB token.
SQLLobOpen
This function opens the operation target LOB data. The function must always be declared first, whenever a LOB operation is executed. If each LOB related function is called without calling Open and Close, every function internally executes open and close. If the same LOB instance is opened twice within a transaction, an error occurs. An error also occurs when attempting to reopen the same LOB instance by using a different locator.
Syntax
SQLRETURN SQLLobOpen (SQLHSTMT StatementHandle,
SQLINTEGER Locator,
SQLSMALLINT Mode,
SQLINTEGER *Indicator);
Parameters
StatementHandle
Input
Statement handle.
SourceLocator
Input
LOB locator.
Mode
Input
Position value of the data to be returned.
Indicator
Input
NULL indicator pointer.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
24000
Invalid cursor state.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLLobOpen function.
SQLLobPutData
This function writes data to a specified position within a LOB.
Syntax
SQLRETURN SQLLobPutData (SQLHSTMT StatementHandle,
SQLINTEGER *DestLocator,
SQLBIGINT DestOffset,
SQLSMALLINT SourceCType,
SQLPOINTER Source,
SQLINTEGER *ByteLength,
SQLINTEGER *CharLength,
SQLINTEGER *Indicator);
Parameters
StatementHandle
Input
Statement handle.
DestLocator
Input
LOB locator.
DestOffset
Input
Position to write in LOB data.
SourceCType
Input
C type of the data to write.
Source
Input
Pointer of the data to write.
ByteLength
Output
Length of the written BLOB type data.
CharLength
Output
Length of the written CLOB type data.
Indicator
Input
NULL indicator pointer.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
24000
Invalid cursor state.
HY000
General error.
HY001
Memory allocation error.
HY010
Function sequence error.
HY013
Memory management error.
HYT01
Database connection time limit exceeded.
IM001
Driver does not support the SQLLobPutData function.
SQLLobTruncate
This function truncates LOB data.
Syntax
SQLRETURN SQLLobTruncate (SQLHSTMT StatementHandle,
SQLINTEGER *Locator,
SQLBIGINT NewLength,
SQLINTEGER *Indicator);
Parameters
StatementHandle
Input
Statement handle.
Locator
Input
LOB locator.
NewLength
Input
New LOB data length after being truncated.
Indicator
Input
NULL indicator pointer.
Return Code
SQL_SUCCESS
Function finished successfully.
SQL_SUCCESS_WITH_INFO
Function finished successfully, but there is a warning message.
SQL_INVALID_HANDLE
The handle given to an input parameter is invalid.
SQL_STILL_EXECUTING
Previously executed SQL statement has not finished.
SQL_ERROR
Critical error occurred.
SQLSTATE
01000
General warning.
01004
Character string is truncated from the right.
07006
Violation of limited data type property.
07S01
Default parameter is incorrectly used.
08S01
Failed to connect to server for communication.
HY000
General error.
HY001
Memory allocation error.
HY008
Operation is canceled.
HY009
NULL pointer is incorrectly used.
HY010
Function sequence error.
HY013
Memory management error.
HY019
Data that is neither character nor binary was sent by being divided.
HY090
Invalid character string or buffer length.
HYT01
Database connection time limit exceeded.
Last updated