|
|
The following sections serve as a function reference for experienced programmers. The descriptions in this appendix apply to MyODBC 3.5x.
Allocates memory for a connection handle. The function is deprecated and has been replaced with SQLAllocHandle(), which is called with the SQL_HANDLE_DBC argument.
Obtains an environment handle from the driver. The function is deprecated and has been replaced with SQLAllocHandle(), which is called with the SQL_HANDLE_ENV argument.
SQLAllocHandle (handle_type, input_handle, output_handle_pointer);
Allocates a handle (either a connection, descriptor, environment, or statement handle).
The handle_type can be one of SQL_HANDLE_ENV (environment handle), SQL_HANDLE_DBC (connection handle), or SQL_HANDLE_STMT (statement handle).
The input_handle describes the context for allocating the new handle. This will be SQL_ NULL_HANDLE if the handle_type is SQL_HANDLE_ENV, an environment handle if the handle_ type is
SQL_HANDLE_DBC, and a connection handle if it's SQL_HANDLE_STMT.
The output_handle_pointer is a pointer to a buffer to where to return the handle.
Allocates memory for a statement handle. The function is deprecated and has been replaced with SQLAllocHandle(), which is called with the SQL_HANDLE_STMT argument.
SQLBindParameter(statement_handle, parameter_number, parameter_type,– value_type, sql_type, column_size, decimal_digits,– parameter_value_pointer, buffer_length, string_length_pointer);
Binds a parameter marker in a SQL statement. The parameter_number starts at 1. For example:
SQLUINTEGER id_ptr; SQLINTEGER idl_ptr; // Prepare SQL SQLPrepare(sth, "INSERT INTO customer(id) VALUES(?)", SQL_NTS); // Bind id to the parameter for the id column SQLBindParameter(sth, 1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_LONG, 0, 0, &id_ptr, 0, &idl_ptr); // ... SQLExecute(sth);
SQLBulkOperations
SQLBulkOperations(statement_handle, operation);
Performs bulk operations.
SQLCancel(statement_handle)
Cancels operations on the specified statement handle.
SQLCloseCursor(statement_handle);
Closes any open cursors for the specified statement handle.
SQLColAttribute (statement_handle, record_number,– field_identifier, character_attribute_pointer, buffer_length,– string_length_pointer, numeric_attribute_pointer);
Describes attributes of a field from the result set.
The record_number argument is the number of the record, starting at 1.
The field_identifier argument specifies the field to be returned.
The character_attribute_pointer argument points to a buffer where the value is to be returned (if it's a string, otherwise it's not used).
The buffer_length argument can contain one of the following values:
The length of the character_attribute_pointer (or SQL_NTS) if character_attribute_pointer points to a string.
The result of SQL_LEN_BINARY_ATTR(length) if character_attribute_pointer points to a binary buffer.
One of SQL_IS_INTEGER, SQL_IS_UNINTEGER, SQL_SMALLINT, or SQLUSMALLINT if character_attribute_pointer points to a specific data type of fixed length.
SQL_IS_POINTER if character_attribute_pointer points to another pointer.
The string_length-pointer argument points to a buffer where the total number of bytes from character_attribute_pointer is to be returned (excluding the null byte).
For character data, if the buffer_length is less than the number of bytes to return, the data is truncated. For other cases, it's assumed to be 32 bits.
The numeric_attribute_pointer argument points to an integer buffer where to return a numeric value. It's not used if the return value is not numeric.
Describes attributes of a field from the result. The function is deprecated and has been replaced with SQLColAttribute().
SQLColumnPrivileges(statement_handle, catalog_name, catalog_name_length, schema_name, schema_name_length, table_name, table_name_length, column_name, column_name_length);
Returns a list of fields and privileges.
SQLColumns(statement_handle, catalog_name, catalog_name_length, schema_name, schema_name_length, table_name, table_name_length, column_name, column_name_length);
Returns a list of column names.
SQLConnect(connection_handle, datasource_name, datasource_name_length, user_name, user_name_length, password, password_length);
Connects to the data source with the specified username and password.
Implemented by the Driver Manager, this function returns a list of available data sources.
SQLDescribeCol(statement_handle, column_number, column_name, buffer_length, name_length_pointer, data_type_pointer, column_size_pointer, decimal_digits_pointer, nullable_pointer);
Describes a column in the result set.
The column_number argument is the number of the column in the result set, starting at 1.
The column_name argument points to a buffer where the column name is returned (read from
SQL_DESC_NAME). Returns an empty string if the name is not available.
The buffer_length argument is the length in characters of the column_name buffer.
The name_length_pointer argument points to a buffer where to return the number of bytes available to return in column_name (excluding the null byte). If the length to be returned is greater than buffer_length, the column name is truncated.
The data_type_pointer argument points to a buffer where the SQL data type is to be returned, obtained from SQL_DESC_CONCISE_TYPE. It returns SQL_UNKNOWN_TYPE if the type is not available.
The column_size_pointer argument points to a buffer where the size of the column is to be returned or 0 if this is not available.
The decimal_digits_pointer argument points to a buffer where the number of decimals of the column is to be returned or 0 if this is not available.
The nullable_pointer argument points to a buffer where the nullability is to be returned (SQL_NO_NULLS, SQL_NULLABLE, or SQL_NULLABLE_UNKOWN).
SQLDescribeParam(statement_handle, parameter_number, data_type_pointer, parameter_size_pointer, decimal_digits_pointer, nullable_pointer);
Returns a description of the parameter.
The parameter_number argument specifies the parameter (starting at 1).
The data_type_pointer points to a buffer where the SQL data type is to be returned.
The parameter_size_pointer argument points to a buffer where the parameter column size is to be returned.
The decimal_digits_pointer argument points to a buffer where the number of decimals of the column is to be returned, or 0 if this is not available.
The nullable_pointer argument points to a buffer where the nullability is to be returned (SQL_NO_NULLS, SQL_NULLABLE, or SQL_NULLABLE_UNKOWN).
SQLDisconnect(connection_handle);
Closes the connection specified by the connection handle.
SQLDriverConnect (connection_handle, window_handle, in_connection, in_connection_length, out_connection, out_connection_length, buffer_length, prompt_flag);
Connects to a server. Use instead of SQLConnect to connect without a DSN, use driver-specific connection information, or use to prompt the user for connection information.
The window_handle argument can be the handle of the parent window or a null pointer if either there are no dialog boxes or the window handle is not being used.
The in_connection argument can be a full connection, a partial connection string, or an empty string.
The in_connection_length argument is the length in bytes of the in_connection string.
The out_connection argument points to a buffer where the connection string is to be returned.
The out_connection_length argument is the length of the out_connection buffer.
The buffer_length argument points to a buffer where the number of characters available to return is to be returned. If the number of characters is greater than the buffer_length, the out_ connection is truncated.
The prompt_flag argument specifies whether the driver must prompt for more information to connect. It can be SQL_DRIVER_PROMPT, SQL_DRIVER_COMPLETE, SQL_DRIVER_COMPLETE_ REQUIRED, or SQL_DRIVER_NOPROMPT.
Implemented by the Driver Manager, this function returns details of the installed drivers.
SQLEndTran(handle_type, handle, completion_type);
Ends an open transaction, calling a rollback or commit.
The handle_type argument contains either SQL_HANDLE_ENV or SQL_HANDLE_DBC depending on the type of handle (environment or connection).
The handle argument specifies the actual handle.
The completion_type determines whether the transaction is ended with a commit or a rollback, and it can be either SQL_COMMIT or SQL_ROLLBACK.
This function is for returning error information and is deprecated. You can use SQLGetDiagRec or SQLGetDiagField to replace it.
SQLExecDirect(statement_handle, sql, sql_length);
Executes a SQL statement. Quicker than SQLExecute if the statement is only to be executed once, as there is no need to prepare it.
SQLExecute(statement_handle);
Executes a previously prepared statement (with SQLPrepare). Use SQLExecDirect if the statement is only to be executed once and there is no need to prepare it.
This function returns scrollable results and is deprecated. Instead use SQLFetchScroll.
SQLFetch(statement_handle);
Returns the next row of data.
SQLFetchScroll(statement_handle, fetch_type, offset);
Returns data for the specified row.
The fetch_type argument can be SQL_FETCH_NEXT (the next row, equivalent to the SQLFetch () function), SQL_FETCH_PRIOR (the previous row), SQL_FETCH_FIRST (the first row), SQL_FETCH_LAST (the last row), SQL_FETCH_ABSOLUTE (a row offset from the first row), SQL_FETCH_RELATIVE, or
SQL_FETCH_BOOKMARK (a row offset from the current row).
The offset argument specifies the row to fetch, either from the first row or the current row, depending on the fetch_type argument.
Frees the connection handle. The function is deprecated, so instead use SQLFreeHandle.
Frees the environment handle. The function is deprecated, so instead use SQLFreeHandle.
SQLFreeHandle(handle_type,handle);
Frees a handle (either connection, descriptor, environment, or statement handle).
The handle_type can be SQL_HANDLE_ENV (environment handle), SQL_HANDLE_DBC (connection handle), SQL_HANDLE_STMT (statement handle), or SQL_HANDLE_DESC (descriptor handle).
The handle argument is the specific handle to be freed.
SQLFreeStmt(statement_handle, option);
Stops the processing of a statement.
The option argument can be SQL_CLOSE (closes the cursor, same as SQLCloseCursor, with the possibility of reopening the cursor), SQL_DROP (frees the statement handler and closes the cursor, although this usage has been deprecated and you should instead use SQLFreeHandle), SQL_UNBIND (frees all column buffer bound SQLBindCol), and SQL_RESET_PARAMS (frees all parameter buffers set by SQLBindParameter).
SQLForeignKeys(statement_handle, primary_key_catalog_name, primary_key_catalog_name_length, primary_key_schema_name, primary_key_schema_name_length, primary_key_table_name, priamry_key_table_name_length, foreign_key_catalog_name, foreign_key_catalog_name_length, foreign_key_schema_name, foreign_key_schema_name_length, foreign_key_table_name, foregn_key_table_name_length);
Returns foreign keys in the specified table and foreign keys in other tables linked with the specified table.
SQLRETURN SQLGetConnectAttr(connection_handle, attribute, value_pointer, buffer_length, string_length_pointer);
Returns the value of a connection attribute. The attribute argument can be one of the values in Table H.2.
Attribute | value_pointer Contents |
---|---|
SQL_ATTR_AUTOCOMMIT | Indicates whether to use auto-commit of or manual commit mode. Can be SQL_AUTOCOMMIT_OFF ( in which case transactions must be ended with SQLEndTran) or SQL_AUTOCOMMIT_ON (the default). |
SQL_ATTR_CONNECTION_DEAD | Can be SQL_CD_TRUE (the connection is dead) or SQL_CD_FALSE (the connection is still alive). |
SQL_ATTR_CONNECTION_ TIMEOUT | The number of seconds to wait for a SQL statement to execute before timing out. Set to 0 (the default), it means there is no timeout. |
SQL_ATTR_CURRENT_CATALOG | The name of the catalog. |
SQL_ATTR_LOGIN_TIMEOUT | The number of seconds to wait while connecting before timing out. 0 indicates no timeout. |
SQL_ATTR_ODBC_CURSORS | Indicates how the Driver Manager uses the cursor library. |
SQL_ATTR_PACKET_SIZE | Indicates the network packet size, in bytes. |
SQL_ATTR_QUIET_MODE | The parent window handle of the application or null if the driver does not display dialog boxes. |
SQL_ATTR_TRACE | Can be SQL_OPT_TRACE_OFF (the default, do not perform tracing), or SQL_OPT_TRACE_ON (perform tracing). |
SQL_ATTR_TRACEFILE | The name of the trace file. |
SQL_ATTR_TRANSLATE_LIB | The name of the library containing the SQLDriverToDataSource and SQLDataSourceToDriver functions. |
SQL_ATTR_TRANSLATE_OPTION | A 32-bit flag value passed to the translation DLL. |
SQL_ATTR_TXN_ISOLATION | A 32-bit bit mask that sets the transaction isolation level. Need to endthe transaction with SQLEndTran first before calling SQLSetConnectAttr with this option. |
The value_pointer argument is the pointer in which the value is to be returned.
The buffer_length argument can contain one of the following values:
The length of the value_pointer (or SQL_NTS) if value_pointer points to a string.
The result of SQL_LEN_BINARY_ATTR(length) if value_pointer points to a binary buffer.
One of SQL_IS_INTEGER, SQL_IS_UNINTEGER, SQL_SMALLINT, or SQLUSMALLINT if
value_pointer points to a specific data type of fixed length.
SQL_IS_POINTER if value_pointer points to another pointer.
The string_length_pointer argument points to a buffer where the number of characters available to return are to be returned (excluding null bytes). If the number of characters is greater than the buffer_length, the value in value_pointer is truncated.
Returns the connection option value. The function has been deprecated, so instead use SQLGetConnectAttr.
SQLGetCursorName(statement_handle,cursor_name,cursor_name_length, name_length_pointer);
Returns the name of the cursor associated with the statement handle.
The cursor_name argument points to a buffer where the cursor name is returned.
The name_length_pointer argument points to a buffer where the number of characters available to return are to be returned. If the number of characters is greater than the name_length_ pointer, the cursor_name is truncated.
SQLGetDiagField(handle_type, handle, record_number, diagnostic_identifier, diagnostic_identifier_pointer, buffer_length, diagnostic_identifier_length_pointer);
Returns error, warning, and status diagnostic information.
The handle_type can be SQL_HANDLE_ENV (environment), SQL_HANDLE_DBC (connection),
SQL_HANDLE_STMT (statement), or SQL_HANDLE_DESC (description).
The handle_argument contains the specific handle of type handle_type.
The record_number argument is the record (starting at 1) from which to return information, if any.
The diagnostic_identifier can be one of the values in Table H.3.
diagnostic_identifier | Description |
---|---|
SQL_DIAG_CLASS_ORIGIN | Returns a string indicating the SQLSTATE class origin (for example, ISO9075 or ODBC 3.0). |
SQL_DIAG_COLUMN_NUMBER | Returns the column number from the result set or parameter number ina parameter set, starting at 0. If neither of these apply, it will contain SQL_ NO_COLUMN_NUMBER or SQL_COLUMN_NUMBER_UNKNOWN. |
SQL_DIAG_CONNECTION_ NAME | Returns a string containing the connection name to which the diagnostics refer. |
SQL_DIAG_CURSOR_ROW_ COUNT | Returns the number of rows in the cursor. |
SQL_DIAG_MESSAGE_TEXT | Returns a string with the diagnostic (error or warning) message. |
SQL_DIAG_NATIVE | Returns a native error code (an integer) or 0 if there is none. |
SQL_DIAG_NUMBER | Returns the number of status records available to the handle (currently the driver returns 1). |
SQL_DIAG_RETURNCODE | Returns the function return code. |
SQL_DIAG_ROW_COUNT | Returns the number of rows affected by a SQL operation that modifies data (such as INSERT or DELETE) run by SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos. |
SQL_DIAG_ROW_NUMBER | Returns the row number in a result set or parameter number in a parameter set, starting at 1. If neither of these apply, it will contain SQL_NO_ROW_NUMBER or SQL_ROW_NUMBER_UNKNOWN. |
SQL_DIAG_SERVER_NAME | Returns a string containing the server name to which the diagnostics refer. |
SQL_DIAG_SQLSTATE | Returns a five-character string containing the SQLSTATE code. |
SQL_DIAG_SUBCLASS_ORIGIN | Returns a string indicating the SQLSTATE subclass origin (for example, ISO9075 or ODBC 3.0). |
The diagnostic_id_pointer points to a buffer where the diagnostic data is to be returned.
The buffer_length argument can contain one of the following values:
The length of the diagnostic_identifier_pointer (or SQL_NTS) if diagnostic_identifier_pointer points to a string.
The result of SQL_LEN_BINARY_ATTR(length) if diagnostic_identifier_pointer points to a binary buffer.
One of SQL_IS_INTEGER, SQL_IS_UNINTEGER, SQL_SMALLINT, or SQLUSMALLINT if diagnostic_identifier_pointer points to a specific data type of fixed length.
SQL_IS_POINTER if diagnostic_identifier_pointer points to another pointer.
The diagnostic_identifier_length_pointer argument points to a buffer where the number of characters available to return are to be returned (excluding null bytes). If the number of characters is greater than the buffer_length, the diagnostic_identifier_pointer is truncated.
SQLGetDiagField does not post the same diagnostics on itself. Instead it returns one of the following values: SQL_SUCCESS, SQL_SUCCESS_WITH_INFO (success but the data was truncated), SQL_INVALID_HANDLE, SQL_ERROR (if the arguments were not valid and so on), or SQL_NO_ DATA.
SQLGetDiagRec(handle_type, handle, recorn_number, sql_state, native_error_pointer, message_text, message_text_length, text_length_pointer);
Returns additional diagnostic information. It is usually called when a previous call to a function has returned SQL_SUCCESS or SQL_SUCCESS_WITH_INFO.
The handle_type can be SQL_HANDLE_ENV (environment), SQL_HANDLE_DBC (connection),
SQL_HANDLE_STMT (statement), or SQL_HANDLE_DESC (description).
The handle_argument contains the specific handle of type handle_type.
The record_number argument is the record (starting at 1) from which to return information, if any.
The sql_state argument points to a buffer where the five-character SQLSTATE code is to be returned.
The native_error_pointer argument points to a buffer where the native error code is to be returned.
The message_text argument points to a buffer where the diagnostic message (error or warning) is to be returned.
The message_text_length argument contains the length of the message_text buffer.
The text_length_pointer argument points to a buffer where the number of characters available to return are to be returned. If the number of characters is greater than the message_text_length, the message_text is truncated.
SQLGetEnvAttr(environment_handle, attribute, value_pointer, buffer_length, string_length_pointer);
Returns the environment attribute value.
The attribute argument can be one of the supported values listed in Table H.4.
Attribute | value_pointer Contents |
---|---|
SQL_ATTR_CONNECTION_ POOLING | A 32-bit value for enabling or disabling connection pooling. |
SQL_ATTR_CP_MATCH | A 32-bit value for determining how a connection is selected from the available pool. |
SQL_ATTR_ODBC_VERSION | A32-bit integer for determining whether behavior is ODBC 2.x or ODBC 3.x. This can be SQL_OV_ODBC3 or SQL_OV_ODBC2. |
The value_pointer argument points to a buffer where the attribute value is to be returned.
The buffer_length argument is the length of value_pointer if it points to a string; otherwise it's unused.
The string_length_pointer points to a buffer where the number of characters available to return are to be returned. If the number of characters is greater than the buffer_length, the value_ pointer is truncated.
SQLGetFunctions(connection_handle, function_id, supported_pointer);
Returns the functions the driver supports.
The function_id argument can be an individual function ID, or it can be either SQL_API_ ODBC3_ALL_FUNCTIONS or SQL_API_ALL_FUNCTIONS. The former is used by ODBC3, the latter by ODBC2.
The supported_pointer argument points to a value containing either SQL_FALSE or SQL_TRUE (if function_id was a single function, indicating whether the function is supported or not), or an array of such values (starting a 0).
SQLGetInfo(connection_handle,info_type, info_value_pointer, buffer_length, string_length_pointer);
Returns information about the driver and server.
The info_type argument contains the type of information (such as SQL_DRIVER_HDESC or
SQL_DRIVER_HSTMT).
The info_value_pointer argument points to a buffer where the information is to be returned, depending on the info_type argument.
The buffer_length argument contains the length of the info_value_pointer buffer. If info_value_ pointer does not point to a string, buffer_length is ignored.
The string_length_pointer points to a buffer where the total number of bytes is to be returned (excluding the null byte). If the length is greater than buffer_length, the value in info_value_pointer is truncated.
SQLGetStmtAttr(statement_handle, attribute, value_pointer, buffer_length, string_length_pointer);
Returns the statement attribute value.
The attribute argument can be one of the supported options listed in Table H.5.
Attribute | value_pointer Contents |
---|---|
SQL_ATTR_CURSOR_SCROLLABLE | Can be SQL_NONSCROLLABLE (scrollable cursors not required on the statement handle). If SQLFetchScroll is called with this handle, fetch_type can only contain SQL_FETCH_NEXT (the default) or SQL_SCROLLABLE (scrollable cursors required on the statement handle). If SQLFetchScroll is called with this handle, fetch_type can contain any valid handle. This attribute affects calls to SQLExecDirect and SQLExecute. |
SQL_ATTR_CURSOR_SENSITIVITY | Can be SQL_UNSPECIFIED (the default where the cursor type is unspecified), SQL_INSENSITIVE (cursors show the result set without showing any changes made by other cursors), or SQL_SENSITIVE (cursors show all changes made to a result set byother cursors). This affects calls to SQLExecute and SQLExecDirect. |
SQL_ATTR_CURSOR_TYPE | Specifies the cursor type and can contain SQL_CURSOR_ FORWARD_ONLY, SQL_CURSOR_STATIC, SQL_CURSOR_ KEYSET_DRIVEN (thedriver uses the keys for the number of rows specified in the SQL_ATTR_KEYSET_SIZE statement attribute), or SQL_CURSOR_DYNAMIC. |
SQL_ATTR_KEYSET_SIZE | Number of rows in the keyset for a SQL_CURSOR_KEYSET_ DRIVEN type cursor. |
SQL_ATTR_MAX_LENGTH | Maximum amount of data the driver returns from character or binary columns. If the value_pointer is less than the amount of data, SQLFetch and SQLGetData data will be truncated and return SQL_SUCCESS_WITH_INFO. |
SQL_ATTR_MAX_ROWS | Maximum number of rows the driver can return (0 is no limit). |
SQL_ATTR_NOSCAN | Can be SQL_NOSCAN_OFF (the driver scans the SQL statement for escapes, the default), or SQL_NOSCAN_ON (the driver does not scan forescapes). |
SQL_ATTR_PARAM_BIND_TYPE | Can be SQL_PARAM_BIND_BY_COLUMN (the default, which indicates column-wise binding), or the length of the structure or buffer for row-wise binding. |
SQL_ATTR_PARAM_OPERATION_ PTR | Points to an array containing SQL_PARAM_PROCEED or SQL_ PARAM_IGNORE that determines whether a parameter is to be ignored during execution. Can also be set to null pointer, in which case no parameter status values are returned. |
SQL_ATTR_PARAM_STATUS_PTR | Points to an array of values (one for each row) with status information after a call to SQLExecute or SQLExecDirect containing one of the following: SQL_PARAM_SUCCESS, SQL_PARAM_SUCCESS_ WITH_INFO (successful with a warning), SQL_PARAM_ERROR, SQL_PARAM_UNUSED (usually because SQL_PARAM_IGNORE was set), or SQL_PARAM_DIAG_UNAVAILABLE. Can also be set to a null pointer, in which case data is not returned. |
SQL_ATTR_PARAMS_PROCESSED_ PTR | Points to a buffer where the number of processed sets of parameters, including errors, is returned. Can be a null pointer, in which case no number is returned. |
SQL_ATTR_PARAMSET_SIZE | Number of values for each parameter. |
SQL_ATTR_QUERY_TIMEOUT | The number of seconds to wait for a SQL statement to execute before timing out. If the value_pointer is 0 (the default), there will be notimeout. |
SQL_ATTR_ROW_ARRAY_SIZE | The number of rows returned by a call to SQLFetch or SQLFetchScroll. The default is 1. |
SQL_ATTR_ROW_BIND_OFFSET_ PTR | Points to an offset added to pointers to change binding of column data. |
SQL_ATTR_ROW_BIND_TYPE | Sets the binding orientation. Can be either SQL_BIND_BY_ COLUMN (indicates column-wise binding) or the length of the structure or buffer where the results are going to be bound (for row-wise binding). |
SQL_ATTR_ROW_NUMBER | The number of the current row or 0 if this cannot be determined. |
SQL_ATTR_ROW_OPERATION_PTR | Points to an array of elements (one for each row) containing either SQL_ROW_PROCEED or SQL_ROW_IGNORE, determining whether the row is to be included in a bulk operation (this does not include SQLBulkOperations). This can also be set to a null pointer, in which case an array will not be returned. |
SQL_ATTR_ROW_STATUS_PTR | Points to an array of values (one for each row) containing row status values after a call to either SQLFetch or SQLFetchScroll. Can also be set to a null pointer, and the driver will not return the array. |
SQL_ATTR_ROWS_FETCHED_PTR | Points to a buffer where the number of rows returned or affected from a SQLFetch, SQLFetchScroll, SQLSetPos, or SQLBulkOperations call is returned, including errors. |
SQL_ATTR_SIMULATE_CURSOR | Can be SQL_SC_NON_UNIQUE (not definite that that simulated positioned UPDATE or DELETE statements will affect only one row), SQL_SC_TRY_UNIQUE (driver attempts to ensure that simulated positioned UPDATE or DELETE statements affect only one row), or SQL_SC_UNIQUE (definite that simulated positioned UPDATE or DELETE statements affect only one row.) |
The value_pointer argument points to a buffer where the value of attribute is to be returned.
The buffer_length argument can contain one of the following values:
The length of the value_pointer (or SQL_NTS) if value_pointer points to a string.
The result of SQL_LEN_BINARY_ATTR(length) if value_pointer points to a binary buffer.
One of SQL_IS_INTEGER, SQL_IS_UNINTEGER, SQL_SMALLINT, or SQLUSMALLINT if value_ pointer points to a specific data type of fixed length.
SQL_IS_POINTER if value_pointer points to another pointer.
The string_length_pointer points to a buffer where the total number of bytes is to be returned (excluding the null byte). If the length is greater than buffer_length, the value in value_pointer is truncated.
Returns the statement option value. The function is deprecated, so instead use SQLGetStmtAttr.
SQLGetTypeInfo(statement_handle,data_type);
Returns a SQL result set with information about the specified data type.
Setting data_type to SQL_ALL_TYPES returns information about the data types returned by the server.
SQLNativeSql(connection_handle, sql_string, sql_string_length, modified_sql_string, modified_sql_string_length, string_length_pointer);
Returns a SQL string modified (not executed) by the driver.
The modified_sql_string argument points to a buffer where the modified SQL statement is to be returned.
The modified_sql_string_length argument points to a buffer where the number of bytes (excluding the null byte) is to be returned.
The string_length_pointer points to a buffer where the total number of bytes is to be returned (excluding the null byte). If the length is greater than modified_sql_string_length, the value in modified_sql_string is truncated.
SQLNumParams(statement_handle, parameter_count_pointer);
Returns the number of parameters in a statement.
The parameter_count_pointer argument points to a buffer where the number of parameters is to be returned.
SQLNumResultCols(statement_handle, column_count_pointer);
Returns the number of columns in the result set.
The column_count_pointer argument points to a buffer where the number of columns is to be returned.
Used in conjunction with SQLPutData to supply parameter data at execution time. (This is useful for long data values.)
SQLPrepare(statement_handle, sql_string, sql_string_length);
Prepares a SQL statement for later execution.
SQLPrimaryKeys(statement_handle, catalog_name, catalog_name_length, schema_name, schema_name_length, table_name, table_name_length);
Returns the primary key columns from the specified table.
SQLPutData(statement_handle, data_pointer, data_pointer_length);
For sending column or parameter data at execution time.
The data_pointer argument points to a buffer containing the parameter or column data (the type is that specified by the value_type argument of SQLBindParameter or the target_type argument of SQLBindCol).
The data_pointer_length argument specifies the length of the data sent to SQLPutData (SQL_NTS, SQL_NULL_DATA, or SQL_DEFAULT_PARAM).
SQLRowCount
SQLRowCount(statement_handle, row_count_pointer);
Returns the number of rows affected by a SQL statement that modifies data (such as INSERT or DELETE).
The row_count_pointer argument points to a buffer where the row count is returned or –1 if not available.
SQLSetConnectAttr(connection_handle, attribute, value_pointer, string_length);
Sets a connection attribute.
See SQLGetConnectAttr for a list and description of possible attributes.
The value_pointer argument points to value of the attribute, of which the type depends on the attribute.
The string_length argument can contain one of the following values:
The length of the value_pointer (or SQL_NTS) if value_pointer points to a string.
The result of SQL_LEN_BINARY_ATTR(length) if value_pointer points to a binary buffer.
One of SQL_IS_INTEGER, SQL_IS_UNINTEGER, SQL_SMALLINT, or SQLUSMALLINT if value_ pointer points to a specific data type of fixed length.
SQL_IS_POINTER if value_pointer points to another pointer.
Sets a connection option. This function has been deprecated, so instead use SQLSetConnectAttr.
SQLSetCursorName(statement_handle,cursor_name,cursor_name_length);
Specifies a cursor name.
SQLSetEnvAttr(environment_handle, attribute, value_pointer, string_length_pointer);
Sets an environment attribute. See SQLGetEnvAttr for a list of possible attributes.
SQLSetPos(statement_handle, row_number, operation, lock_type);
Moves a cursor to a position in a fetched block of data and can also refresh data in the row set or update and delete the underlying data.
The row_number argument selects the row in the result set the operation affects (starting at 1). Setting it to 0 applies the operation to every row.
The operation argument specifies the operation to perform and can be SQL_POSITION, SQL_ REFRESH, SQL_UPDATE, or SQL_DELETE. Table H.6 describes the operation argument.
Operation | Description |
---|---|
SQL_POSITION | Driver positions the cursor on row row_number. |
SQL_REFRESH | Driver positions the cursor on row row_number and refreshes data for that row. The row's data is not refetched, which is different from a refresh call to SQLFetchScroll with a fetch_type. |
SQL_UPDATE | Driver positions the cursor on row row_number and updates the associated data with the values in the row set buffers from the TargetValuePtr argument in SQLBindCol. |
SQL_DELETE | Driver positions the cursor on row row_number and deletes the associated data. |
The lock_type argument specifies the row locking operation after the operation is executed, and can be SQL_LOCK_NO_CHANGE, SQL_LOCK_EXCLUSIVE, or SQL_LOCK_UNLOCK.
Sets options affecting cursor behavior. This function is deprecated, so instead use SQLSetStmtAttr.
SQLGetStmtAttr(statement_handle, attribute, value_pointer, string_length);
Sets a statement attribute.
For the list of possible attribute values, see SQLGetStmtAttr.
The value_pointer argument points to value of the attribute, of which the type depends on the attribute.
The string_length argument can contain one of the following values:
The length of the value_pointer (or SQL_NTS) if value_pointer points to a string.
The result of SQL_LEN_BINARY_ATTR(length) if value_pointer points to a binary buffer.
One of SQL_IS_INTEGER, SQL_IS_UNINTEGER, SQL_SMALLINT, or SQLUSMALLINT if value_ pointer points to a specific data type of fixed length.
SQL_IS_POINTER if value_pointer points to another pointer.
Sets a statement option. This function has been deprecated, so instead use SQLSetStmtAttr.
SQLSpecialColumns(statement_handle, identifier_type, catalog_name, catalog_length, schema_name, schema_length, table_name, table_name_length, scope, nullable);
Returns column information that uniquely identifies a row in the specified table or the automatically updated columns when a value in the record is updated by a transaction.
The identifier_type argument contains the type of column to be returned. It must be either
SQL_BEST_ROWID or SQL_ROWVER. SQL_BEST_ROWID returns the smallest set of columns that uniquely identifies a record. (The returned columns can be designed to enable this.) SQL_ ROWVER returns the columns that are automatically updated when a value in the record is updated by a transaction.
The scope argument is the minimum required scope of the row ID. It can be one of the following: SQL_SCOPE_CURROW (The row ID is definitely valid only while on that row), SQL_ SCOPE_TRANSACTION (The row ID is definitely valid for the duration of the current transaction), or SQL_SCOPE_SESSION (The row ID is definitely valid for the entire session).
The nullable argument indicates whether to include columns that can contain nulls. It can be either SQL_NO_NULLS (excluding columns that can contain nulls) or SQL_NULLABLE (including columns that can contain nulls).
SQLStatistics(statement_handle, catalog_name, catalog_name_length, schema_name, schema_name_length, table_name, table_name_length, index_type, reserved);
Returns table and associated index statistics.
The index_type argument can be either SQL_INDEX_UNIQUE or SQL_INDEX_ALL.
The reserved argument can be SQL_ENSURE (return the CARDINALITY and PAGES columns) or
SQL_QUICK (return the CARDINALITY and PAGES columns only if they're readily available).
SQLTablePrivileges(statement_handle, catalog_name, catalog_length, Schema_name, schema_name_length, table_name, table_name_length);
Returns a list of tables and associated privileges.
SQLTables(statement_handle, catalog_name, catalog_length, Schema_name, schema_name_length, table_name, table_name_length, table_type, table_type_length);
Returns the list of tables, catalog, or schema names and table types.
Ends a transaction. This function has been deprecated, so instead use SQLEndTran.
|
|