Driver functionality¶
ODBC関数を使用して、 EDB- ODBCとサーバー間の接続のさまざまな属性に関する特定の情報をODBCにクエリーできます。
SQLGetInfo()は、 EDB- ODBCドライバとEDB Postgres Advanced Serverに関する情報を返します。SQLGetEnvAttr()は、 ODBC環境属性に関する情報を返します。SQLGetConnectAttr()は、個々の接続に固有の属性に関する情報を返します。SQLGetStmtAttr()は、個々のステートメントに固有の属性に関する情報を返します。
ODBC関数を使用して、 ODBCとのインタフェースに使用するオブジェクトの属性を設定することもできます。
SQLSetConnectAttr()ファンクションを使用して、接続属性を設定します。SQLSetEnvAttr()ファンクションを使用して、環境属性を設定します。SQLSetStmtAttr()ファンクションを使用して、ステートメントの属性を設定します。
SQLGetInfo()¶
ODBC SQLGetInfo() ファンクションは、 EDB- ODBCドライバとEDB Postgres
Advanced Serverに関する情報を返します。 info_type として
SQL_ODBC_VER を指定しない限り、 SQLGetInfo()
を呼び出すためのオープン接続が必要です。 SQLGetInfo()
のシグネチャは次のとおりです。
SQLRETURN SQLGetInfo
(
SQLHDBC conn_handle , // Input
SQLUSMALLINT info_type , // Input
SQLPOINTER info_pointer , // Output
SQLSMALLINT buffer_len , // Input
SQLSMALLINT * string_length_pointer // Output
);
conn_handle—接続ハンドル。info_type— SQLGetInfo()が取得している情報のタイプ。info_pointer—取得した値を保持するメモリバッファへのポインタ。
info_type 引数が SQL_DRIVER_HDESC または SQL_DRIVER_HSTMT
の場合、 info_pointer 引数は Input と Output の両方です。
buffer_len—info_pointerが指す、割り当てられたメモリバッファの長さ。info_pointerがNULLの場合、buffer_lenは無視されます。戻り値が固定サイズの場合、buffer_lenは無視されます。buffer_lenは、要求された値が文字の並びのフォームで返される場合にのみ使用されます。string_length_pointer—SQLSMALLINT値へのポインタ。SQLGetInfo()は、要求された値のサイズをこの整数に書き込みます。
典型的な使用法は、 NULL info_pointer を指定して SQLGetInfo()
を呼び出して要求された値の長さを取得し、必要なバイト数を割り当ててから、
SQLGetInfo()
を再度呼び出して(新しく割り当てられたバッファーのアドレスを提供して)実際の値を取得します。最初の呼び出しは、値を保持するために必要なバイト数を取得します。
2番目の呼び出しは値を取得します。
戻り値のサイズが buffer_len を超える場合、情報は切り捨てられ、
NULL は終了します。戻り値が固定サイズの場合、 string_length
は無視され、要求された値のサイズは SQLGetInfo()
によって提供されません。
SQLGetInfo() は、次の形式のいずれかで情報を書き込みます。
SQLUINTEGERビットマスクSQLUINTEGERフラグSQLUINTEGERバイナリ値SQLUSMALLINT値NULLで終わる文字の並び
SQLGetInfo() は、 SQL_SUCCESS 、 SQL_SUCCESS_WITH_INFO 、
SQL_ERROR 、または SQL_INVALID_HANDLE を返します。
次の表に、 EDB Postgres Advanced Server接続に関するEDB- ODBCによって返される情報を示します。
SQL info_type argument and description** |
EDB_ODBC/EDB Postgres Advanced Server returns |
|---|---|
SQL_ACCESSIBLE_PROCEDURES: Indicates if procedures returned by SQLProcedures() can be executed by the application. |
Returns N. Some procedures executed by the SQLProcedures() function might be executed by the application. |
SQL_ACCESSIBLE_TABLES: Indicates if the user has SELECT privileges on all table names returned by SQLTables(). |
Returns N. The user might not have select privileges on one or more tables returned by the SQLTables() function. |
SQL_ACTIVE_CONNECTIONS prev. SQL_MAX_DRIVER_CONNECTIONS: Indicates the maximum number of connections EDB-ODBC can support. |
Returns 0. There's no specified limit to the number of connections allowed. |
SQL_ACTIVE_ENVIRONMENTS: The number of active environments EDB-ODBC can support. |
Returns 0. There's no specified limit to the number of environments allowed. |
SQL_ACTIVE_STATEMENTS prev. SQL_MAX_CONCURRENT_ACTIVITIES: Indicates the maximum number of active statements EDB-ODBC can support. |
Returns 0. There's no specified limit to the number of active statements allowed. |
SQL_AGGREGATE_FUNCTION: Identifies the aggregate functions supported by the server and driver. |
Returns SQL_AF_ALL. |
SQL_ALTER_DOMAIN: Identifies the ALTER DOMAIN clauses supported by the server. |
Returns 0. ALTER DOMAIN clauses aren't supported. |
SQL_ALTER_TABLE: Identifies the ALTER TABLE clauses supported by the server. |
Returns SQL_AT_ADD_COLUMN, SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE, SQL_AT_DROP_TABLE_CONSTRAINT, SQL_AT_CONSTRAINT_INITIALLY_DEFERRED, SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE, SQL_AT_CONSTRAINT_DEFERRABLE |
SQL_ASYNC_MODE: Level of asynchronous mode supported by EDB-ODBC. |
Returns SQL_AM_NONE. Asynchronous mode isn't supported. |
SQL_BATCH_ROW_COUNT: Indicates how the driver returns row counts. |
Returns SQL_BRC_EXPLICIT. Row counts are available when executed by calling SQLExecute or SQLExecDirect. |
SQL_BATCH_SUPPORT: Indicates support for batch statement execution. |
Returns SQL_BS_SELECT_EXPLICIT, SQL_BS_ROW_COUNT_EXPLICIT. The driver supports explicit batches with result set and row count generating statements. |
SQL_BOOKMARK_PERSISTENCE: Indicates level of support for bookmarks. |
Returns SQL_BP_DELETE, SQL_BP_TRANSACTION, SQL_BP_UPDATE, SQL_BP_SCROLL. |
SQL_CATALOG_LOCATION Now SQL_QUALIFIER_LOCATION: Indicates the position of the catalog in a qualified table name. |
Returns SQL_CL_START. The catalog portion of a qualified table name is at the beginning of the name. |
SQL_CATALOG_NAME Now SQL_QUALIFIER_NAME: Indicates support for catalog names. |
Returns Y. The server supports catalog names. |
SQL_CATALOG_NAME_SEPARATOR Now SQL_QUALIFIER_NAME_SEPARATOR: Character separating the catalog name from the adjacent name element. |
Returns '.' The server expects a '.' character between the qualifier and the table name. |
SQL_CATALOG_TERM Now SQL_QUALIFIER_TERM: The term used to describe a catalog. |
Returns catalog. |
SQL_CATALOG_USAGE Now SQL_QUALIFIER_USAGE: Indicates the SQL statements that can refer to catalogs. |
Returns SQL_CU_DML_STATEMENTS. Catalog names can be used in SELECT, INSERT, UPDATE, DELETE, SELECT FOR UPDATE and positioned UPDATE and DELETE statements. |
SQL_COLLATION_SEQ: Returns the name of the collation sequence. |
Returns an empty string. The name of the default collation is unknown. |
SQL_COLUMN_ALIAS: Indicates server support for column aliases. |
Returns Y. The server supports column aliases. |
SQL_CONCAT_NULL_BEHAVIOR: Indicates how the server handles concatenation of NULL values. |
Returns SQL_CB_NON_NULL. Concatenating a NULL value and a non-NULL value results in a NULL value. |
SQL_CONVERT_BIGINT: Indicates conversion support from the BIGINT type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_BINARY: Indicates conversion support from the BINARY type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_BIT: Indicates conversion support from the BIT type using the CONVERT function. |
Returns SQL_CVT_INTEGER, SQL_CVT_BIT. |
SQL_CONVERT_CHAR: Indicates conversion support from the CHAR type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_DATE: Indicates conversion support from the DATE type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_DECIMAL: Indicates conversion support from the DECIMAL type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_DOUBLE: Indicates conversion support from the DOUBLE type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_FLOAT: Indicates conversion support from the FLOAT type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_FUNCTIONS: Lists the scalar conversion functions supported by the server and driver using the CONVERT function. |
Returns SQL_FN_CVT_CONVERT. |
SQL_CONVERT_INTEGER: Lists the conversion support from the INTEGER type using the CONVERT function. |
Returns SQL_CVT_INTEGER, SQL_CVT_BIT. |
SQL_CONVERT_INTERVAL_DAY_TIME: Indicates conversion support from the INTERVAL_DAY_TIME type using the CONVERT function. |
This info_type isn't currently supported. |
SQL_CONVERT_INTERVAL_YEAR_MONTH: Indicates conversion support from the INTERVAL_YEAR_MONTH type using the CONVERT function. |
This info_type isn't currently supported. |
SQL_CONVERT_LONGVARBINARY: Indicates conversion support for the LONG_VARBINARY type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_LONGVARCHAR: Indicates conversion support for the LONGVARCHAR type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_NUMERIC: Indicates conversion support for the NUMERIC type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_REAL: Indicates conversion support for the REAL type using the CONVERT function |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_SMALLINT: Indicates conversion support for the SMALLINT type using the CONVERT function. |
Returns SQL_CVT_INTEGER, SQL_CVT_BIT. |
SQL_CONVERT_TIME: Indicates conversion support for TIME type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CVT_TIMESTAMP: Indicates conversion support for TIMESTAMP type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_TINYINT: Indicates conversion support for the TINYINT type using the CONVERT function. |
Returns SQL_CVT_INTEGER, SQL_CVT_BIT. |
SQL_CONVERT_VARBINARY: Indicates conversion support for the VARBINARY type using the CONVERT function. |
Returns 0. The server doesn't support conversion. |
SQL_CONVERT_VARCHAR: Indicates conversion support for VARCHAR type using the CONVERT function. |
Returns SQL_CVT_INTEGER, SQL_CVT_BIT. |
SQL_CONVERT_WCHAR: Indicates conversion support for the WCHAR type using the CONVERT function. |
This info_type is valid only when using the Unicode driver. Returns 0. The server doesn't support conversion. |
SQL_CONVERT_WLONGVARCHAR: Indicates conversion support for the WLONGVARCHAR type using the CONVERT function. |
This info_type is valid only when using the Unicode driver. Returns 0. The server doesn't support conversion. |
SQL_CONVERT_WVARCHAR: Indicates conversion support for the WVARCHAR type using the CONVERT function. |
This info_type is valid only when using the Unicode driver. Returns`0`. The server doesn't support conversion. |
SQL_CORRELATION_NAME: Indicates server support for correlation names. |
Returns SQL_CN_ANY. Correlation names are supported and can be any valid name. |
SQL_CREATE_ASSERTION: Indicates support for the CREATE ASSERTION statement. |
Returns 0. The CREATE ASSERTION statement isn't supported. |
SQL_CREATE_CHARACTER_SET: Indicates support for the CREATE CHARACTER statement. |
Returns 0. The CREATE CHARACTER statement isn't supported. |
SQL_CREATE_COLLATION: Indicates support for the CREATE COLLATION statement. |
Returns 0. The CREATE COLLATION statement isn't supported. |
SQL_CREATE_DOMAIN: Indicates support for the CREATE DOMAIN statement. |
Returns 0. The CREATE DOMAIN statement isn't supported. |
SQL_CREATE_SCHEMA: Indicates support for the CREATE SCHEMA statement. |
Returns SQL_CS_CREATE_SCHEMA, SQL_CS_AUTHORIZATION. |
SQL_CREATE_TABLE: Indicates support for the CREATE TABLE statement. |
Returns SQL_CT_CREATE_TABLE, SQL_CT_GLOBAL_TEMPORARY, SQL_CT_CONSTRAINT_INITIALLY_DEFERRED, SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE, SQL_CT_CONSTRAINT_DEFERRABLE, SQL_CT_COLUMN_CONSTRAINT, SQL_CT_COLUMN_DEFAULT, SQL_CT_TABLE_CONSTRAINT, SQL_CT_CONSTRAINT_NAME_DEFINITION |
SQL_CREATE_TRANSLATION: Indicates support for the CREATE TRANSLATION statement. |
Returns 0. The CREATE TRANSLATION statement isn't supported. |
SQL_CREATE_VIEW: Indicates support for the CREATE VIEW statement. |
Returns SQL_CV_CREATE_VIEW. |
SQL_CURSOR_COMMIT_BEHAVIOR: Indicates how a COMMIT operation affects the cursor. |
Returns SQL_CB_PRESERVE. Cursors are unchanged and can continue to fetch data. |
SQL_CURSOR_ROLLBACK_BEHAVIOR: Indicates the server behavior after a ROLLBACK operation. |
Returns SQL_CB_PRESERVE. Cursors are unchanged and can continue to fetch data. |
SQL_CURSOR_SENSITIVITY: Indicates how the server synchronizes changes to a result set. |
This info_type isn't currently supported. |
SQL_DATA_SOURCE_NAME: Returns the server name used during connection. |
The value returned is determined by the connection properties. |
SQL_DATA_SOURCE_READ_ONLY: Indicates if the connection is in READ ONLY mode. |
The value returned is determined by the connection properties. |
SQL_DATABASE_NAME: Returns the name of the database. |
The value returned is determined by the connection properties. |
SQL_DATETIME_LITERALS: Indicates the DATETIME LITERALS supported by the server. |
This info_type is not supported. |
SQL_DBMS_NAME: Returns the name of the DBMS system. |
Returns the value given by the dbms_name parameter from the odbc.ini file on Linux or the dbms_name field of page 2 of the Advanced Options dialog box when defining a data source in Windows. The default is EnterpriseDB. |
SQL_DBMS_VER: Returns the server version. |
Determined by the server. |
SQL_DDL_INDEX: Indicates support for creating and dropping indexes. |
Returns SQL_DI_CREATE_INDEX, SQL_DI_DROP_INDEX. |
SQL_DEFAULT_TXN_ISOLATION: Indicates support for transaction isolation by the server. |
Returns TXN_READ_COMMITTED. Nonrepeatable or phantom reads are possible. Dirty reads aren't. |
SQL_DESCRIBE_PARAMETER: Indicates support for the DESCRIBE INPUT statement. |
Returns N. The DESCRIBE INPUT statement isn't supported. |
SQL_DM_VER: The version of the driver manager. |
Determined by driver manager. |
SQL_DRIVER_HDBC: The driver's connection handle. |
Returns an SQLULEN value that contains the driver’s connection handle. |
SQL_DRIVER_HDESC: The driver descriptor handle. |
Returns an SQLULEN value that contains driver’s descriptor handle. |
SQL_DRIVER_HENV: The driver's environment handle. |
Returns an SQLULEN value that contains the driver’s environment handle. |
SQL_DRIVER_HLIB: The driver handle. |
Returns an SQLULEN value that contains the library handle (returned to the ODBC driver manager when the manager loaded the driver). |
SQL_DRIVER_HSTMT: The driver's statement handle. |
Returns an SQLULEN value that contains the driver’s statement handle. |
SQL_DRIVER_NAME: The name of the driver. |
Returns EDB-ODBC.DLL |
SQL_DRIVER_ODBC_VER: Identifies the ODBC version that the driver supports. |
Returns 03.50 |
SQL_DRIVER_VER: Identifies the driver version. |
Returns 9.0.0.6 |
SQL_DROP_ASSERTION: Lists the DROP ASSERTION clauses supported by the server. |
Returns 0. |
SQL_DROP_CHARACTER_SET: Lists the DROP CHARACTER clauses supported by the server. |
Returns 0. |
SQL_DROP_COLLATION: Lists the DROP COLLATION clauses supported by the server. |
Returns 0. |
SQL_DROP_DOMAIN: Lists the DROP DOMAIN clauses supported by the server. |
Returns 0. |
SQL_DROP_SCHEMA: Lists the DROP SCHEMA clauses supported by the server. |
Returns SQL_DS_DROP_SCHEMA, SQL_DS_RESTRICT, SQL_DS_CASCADE. |
SQL_DROP_TABLE: Lists the DROP TABLE clauses supported by the server. |
Returns SQL_DT_DROP_TABLE, SQL_DS_RESTRICT, SQL_DS_CASCADE. |
SQL_DROP_TRANSLATION: Lists the DROP TRANSLATION clauses supported by the server. |
Returns 0. |
SQL_DROP_VIEW: Lists the DROP VIEW clauses supported by the server. |
Returns SQL_DV_DROP_VIEW, SQL_DS_RESTRICT, SQL_DS_CASCADE. |
SQL_DYNAMIC_CURSOR_ATTRIBUTES1: Describes the first set of dynamic cursor attributes supported by the driver. |
Returns 0. |
SQL_DYNAMIC_CURSOR_ATTRIBUTES2: Describes the second set of dynamic cursor attributes supported by the driver. |
Returns 0. |
SQL_EXPRESSIONS_IN_ORDERBY: Indicates server support for ORDER BY. |
Returns Y. |
SQL_FETCH_DIRECTION: Indicates FETCH order options (deprecated in ODBC 3.0). |
Returns SQL_FD_FETCH_NEXT, SQL_FD_FETCH_FIRS, SQL_FD_FETCH_LAST, SQL_FD_FETCH_PRIOR, SQL_FD_FETCH_ABSOLUTE, SQL_FD_FETCH_RELATIVE, SQL_FD_FETCH_BOOKMARK. |
SQL_FILE_USAGE: Indicates how a single-tier driver treats files on the server. |
Returns SQL_FILE_NOT_SUPPORTED. The driver isn't a single-tier file. |
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1: Describes the forward-only cursor attributes supported by the driver. |
Returns SQL_CA1_NEXT. |
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2: Describes extended attributes for the forward-only cursor designated by SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1. |
Returns SQL_CA2_READ_ONLY_CONCURRENCY, SQL_CA2_CRC_EXACT. |
SQL_GETDATA_EXTENSIONS: Lists supported extensions to SQLGetData. |
Returns SQL_GD_ANY_COLUMN, SQL_GD_ANY_ORDER, SQL_GD_BLOCK, SQL_GD_BOUND. |
SQL_GROUP_BY: Indicates the relationship between a GROUP BY clause and columns in the SELECT list. |
Returns SQL_GB_GROUP_BY_EQUALS_SELECT. |
SQL_IDENTIFIER_CASE: Indicates case sensitivity and case storage of SQL identifiers. |
Returns SQL_IC_LOWER. |
SQL_INDEX_KEYWORDS: Indicates support for the CREATE INDEX statement. |
Returns SQL_IK_NONE. |
SQL_INFO_SCHEMA_VIEWS: Lists the views supported in the INFORMATION_SCHEMA. |
Returns 0. |
SQL_INTEGRITY Prev. SQL_ODBC_SQL_OPT_IEF: Indicates server support for referential integrity syntax checking. |
Returns N. |
SQL_INSERT_STATEMENT: Indicates level of support for the INSERT statement. |
Returns SQL_IS_INSERT_LITERALS, SQL_IS_INSERT_SEARCHED, SQL_IS_SELECT_INTO. |
SQL_KEYSET_CURSOR_ATTRIBUTES1: Describes the first set of keyset cursor attributes supported by the driver. |
Returns SQL_CA1_NEXT, SQL_CA1_ABSOLUTE, SQL_CA1_RELATIVE, SQL_CA1_BOOKMARK, SQL_CA1_LOCK_NO_CHANGE, SQL_CA1_POS_POSITION, SQL_CA1_POS_UPDATE, SQL_CA1_POS_DELETE, SQL_CA1_POS_REFRESH, SQL_CA1_BULK_ADD, SQL_CA1_BULK_UPDATE_BY_BOOKMARK, SQL_CA1_BULK_DELETE_BY_BOOKMARK, SQL_CA1_BULK_FETCH_BY_BOOKMARK. |
SQL_KEYSET_CURSOR_ATTRIBUTES2: Describes the second set of keyset cursor attributes supported by the driver. |
Returns SQL_CA2_READ_ONLY_CONCURRENCY, SQL_CA2_OPT_ROWVER_CONCURRENCY, SQL_CA2_SENSITIVITY_ADDITIONS, SQL_CA2_SENSITIVITY_DELETIONS, SQL_CA2_SENSITIVITY_UPDATES, SQL_CA2_CRC_EXACT. |
SQL_KEYWORDS: Identifies the server-specific reserved keywords. |
Returns “”. There are no server-specific reserved keywords. |
SQL_LIKE_ESCAPE_CLAUSE: Indicates support for an escape character in LIKE predicates. |
Returns N. EDB Postgres Advanced Server doesn't support escape characters in LIKE predicates. |
SQL_LOCK_TYPES: Lists supported lock types (deprecated in ODBC 3.0). |
Returns SQL_LCK_NO_CHANGE. |
SQL_MAX_ASYNC_CONCURRENT_STATEMENTS: The number of active concurrent statements that the driver can support. |
This info_type is currently unsupported. |
SQL_MAX_BINARY_LITERAL_LEN: The maximum length of a binary literal. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_CATALOG_NAME_LEN: The maximum length of a catalog name on the server. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_QUALIFIER_NAME_LEN: The maximum length of a qualifier. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_CHAR_LITERAL_LEN: The maximum number of characters in a character string. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_COLUMN_NAME_LEN: The maximum length of a column name. |
Returns 64. Column names can't exceed 64 characters in length. |
SQL_MAX_COLUMNS_IN_GROUP_BY: The maximum number of columns allowed in a GROUP BY clause. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_COLUMNS_IN_INDEX: The maximum number of columns allowed in an index. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_COLUMNS_IN_ORDER_BY: The maximum number of columns allowed in an ORDER BY clause. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_COLUMNS_IN_SELECT: The maximum number of columns allowed in a SELECT list. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_COLUMNS_IN_TABLE: The maximum number of columns allowed in a table. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_CONCURRENT_ACTIVITIES prev. SQL_MAX_ACTIVE_STATEMENTS: The maximum number of active SQL statements that the driver can support. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_CURSOR_NAME_LEN: The maximum length of a cursor name. |
Returns 32. A cursor name can't exceed 32 characters in length. |
SQL_MAX_DRIVER_CONNECTIONS prev. SQL_ACTIVE_CONNECTIONS: The maximum number of active connections the driver can support. |
Returns 0. There is no specified limit to the number of connections supported. |
SQL_MAX_IDENTIFIER_LEN: The maximum identifier length allowed by the server. |
Returns 64. Identifiers can't exceed 64 characters in length. |
SQL_MAX_INDEX_SIZE: The maximum number of bytes allowed in the (combined) fields of an index. |
Returns 0. The maximum size is unspecified. |
SQL_MAX_OWNER_NAME_LEN Now SQL_MAX_SCHEMA_NAME_LEN: The maximum length of an owner name allowed by the server. |
Returns 64. The maximum length of an owner name is 64 characters. |
SQL_MAX_PROCEDURE_NAME_LEN: The maximum length of a procedure name allowed by the server. |
Returns 0. The maximum length is unspecified. |
SQL_MAX_QUALIFIER_NAME_LEN Now SQL_MAX_CATALOG_NAME_LEN: The maximum length of a qualifier name allowed by the server. |
Returns 0. The maximum length of a qualifier is unspecified. |
SQL_MAX_ROW_SIZE: The maximum length of a row. |
Returns 0. The maximum row length is unspecified. |
SQL_MAX_ROW_SIZE_INCLUDES_LONG: Indicates whether the SQL_MAX_ROW_SIZE includes the length of any LONGVARCHAR or LONGVARBINARY columns in the row. |
Returns Y. SQL_MAX_ROW_SIZE includes the length of any LONGVARCHAR or LONGVARBINARY columns in the row. |
SQL_MAX_SCHEMA_NAME_LEN: The maximum length of a schema name allowed by the server. |
Returns 64. The maximum length of a schema name is 64 characters. |
SQL_MAX_STATEMENT_LEN: The maximum length of a SQL statement. |
Returns 0. Maximum statement length is limited by available memory. |
SQL_MAX_TABLE_NAME_LEN: The maximum length of a table name allowed by the server. |
Returns 64. The maximum length of a table name is 64 characters. |
SQL_MAX_TABLES_IN_SELECT: The maximum number of tables allowed in the FROM clause of a SELECT statement. |
Returns 0. The maximum number of tables allowed is unspecified. |
SQL_MAX_USER_NAME_LEN: The maximum length of the user name allowed by the server. |
Returns 0. The maximum length of a user name is unspecified. |
SQL_MULT_RESULT_SETS: Indicates server support for multiple result sets. |
Returns Y. EDB Postgres Advanced Server supports multiple result sets. |
SQL_MULTIPLE_ACTIVE_TXN: Indicates if the server supports multiple active transactions. |
Returns Y. EDB Postgres Advanced Server supports multiple active transactions. |
SQL_NEED_LONG_DATA_LEN: Indicates if the server needs the length of a LONG data value before receiving the value. |
Returns N. EDB Postgres Advanced Server doesn't need the length of a LONG data value before receiving the value. |
SQL_NON_NULLABLE_COLUMNS: Indicates if the server supports NOT NULL values in columns. |
Returns SQL_NNC_NON_NULL. EDB Postgres Advanced Server does support NOT NULL values in columns. |
SQL_NULL_COLLATION: Indicates where NULL values are located in a result set. |
Returns SQL_NC_HIGH. The location of NULL values in a data set is determined by the ASC and DESC keywords. NULL values are sorted to the high end of the data set. |
SQL_NUMERIC_FUNCTIONS: Lists the numeric functions supported by the driver and the server. |
Returns SQL_FN_NUM_ABS, SQL_FN_NUM_ATAN, SQL_FN_NUM_CEILING, SQL_FN_NUM_COS, SQL_FN_NUM_EXP, SQL_FN_NUM_FLOOR, SQL_FN_NUM_LOG, SQL_FN_NUM_MOD, SQL_FN_NUM_SIGN, SQL_FN_NUM_SIN, SQL_FN_NUM_SQRT, SQL_FN_NUM_TAN, SQL_FN_NUM_RAND, SQL_FN_NUM_POWER, SQL_FN_NUM_ROUND. |
SQL_ODBC_API_CONFORMANCE: Indicates the ODBC 3.0 compliance level. |
Returns SQL_OAC_LEVEL1. The driver conforms to ODBC Level 1 interface. |
SQL_ODBC_INTERFACE_CONFORMANCE: Indicates the ODBC interface that the driver adheres to. |
Returns SQL_OIC_CORE. |
SQL_ODBC_SAG_CLI_CONFORMANCE: Indicates the SQL Access Group compliance level that the driver adheres to. |
Returns SQL_OSCC_NOT_COMPLIANT. The driver isn't SAG CLI compliant. |
SQL_ODBC_SQL_CONFORMANCE: Indicates the SQL grammar level that the driver conforms to. |
Returns SQL_OSC_CORE. The driver conforms to the core grammar level. |
SQL_ODBC_SQL_OPT_IEF Now SQL_INTEGRITY: Indicates server support for referential integrity syntax checking. |
Returns N. The server doesn't support referential integrity syntax checking. |
SQL_ODBC_VER: The ODBC version supported by the driver manager |
Returns 03.52.0000. |
SQL_OJ_CAPABILITIES: Identifies the outer joins that are supported by the server. |
Returns SQL_OJ_LEFT, SQL_OJ_RIGHT, SQL_OJ_FULL, SQL_OJ_NESTED, SQL_OJ_NOT_ORDERED, SQL_OJ_INNER, SQL_OJ_ALL_COMPARISON_OPS. |
SQL_OUTER_JOINS: Indicates support for outer joins and the outer join escape sequence. |
Returns Y. Outer joins are supported. |
SQL_OWNER_TERM prev. SQL_SCHEMA_TERM: The term used to describe a schema. |
Returns schema. |
SQL_ORDER_BY_COLUMNS_IN_SELECT: Indicates if the columns in an ORDER BY clause must be included in the SELECT list. |
Returns N. Columns in an ORDER BY clause don't have to be in the SELECT list. |
SQL_OWNER_USAGE prev. SQL_SCHEMA_USAGE: Returns a string that indicates which statements support schema qualifiers. |
Returns SQL_OU_DML_STATEMENTS, SQL_OU_TABLE_DEFINITION, SQL_OU_INDEX_DEFINITION, SQL_OU_PRIVILEGE_DEFINITION. |
SQL_PARAM_ARRAY_ROW_COUNTS: Indicates if the server returns a single row count or separate row counts for each element in an array when executing a parameterized statement with at least one parameter bound to the array. |
Returns SQL_PARC_BATCH if separate row counts are available for each element in an array. Returns SQL_PARC_NO_BATCH if a single, cumulative row count is available for the entire array. |
SQL_PARAM_ARRAY_SELECTS: Indicates if the server returns one result set or a separate result set for each element in an array (or if the driver doesn't allow this feature) when executing a parameterized statement with at least one parameter bound to the array. |
Returns SQL_PAS_BATCH. One data set is available for each element in an array. |
SQL_POS_OPERATION: Lists the options supported by SQLSetPos(). |
Returns SQL_POS_POSITION, SQL_POS_REFRESH, SQL_POS_UPDATE, SQL_POS_DELETE, SQL_POS_ADD. |
SQL_POSITIONED_STATEMENTS: Lists the supported positioned SQL statements. |
Returns SQL_PS_POSITIONED_DELETE, SQL_PS_POSITIONED_UPDATE, SQL_PS_SELECT_FOR_UPDATE. |
SQL_PROCEDURE_TERM: The term used to describe a procedure. |
Returns procedure. |
SQL_PROCEDURES: Indicates if the server and the driver support SQL procedures and procedure invocation syntax. |
Returns Y. The server and driver support procedures and procedure invocation syntax. |
SQL_QUALIFIER_LOCATION prev. SQL_CATALOG_LOCATION: Indicates the position of the schema name in a qualified table name. |
Returns SQL_CL_START. The catalog portion of a qualified table name is at the beginning of the name. |
SQL_QUALIFIER_NAME prev. SQL_CATALOG_NAME: Indicates server support for catalog names. |
Returns Y. The server supports catalog names. |
SQL_QUALIFIER_NAME_SEPARATOR prev. SQL_CATALOG_NAME_SEPARATOR: Character separating the qualifier name from the adjacent name element. |
Returns '.'. The server expects a '.' character between the qualifier and the table name. |
SQL_QUALIFIER_TERM prev. SQL_CATALOG_TERM: The term used to describe a qualifier. |
Returns catalog. |
SQL_QUALIFIER_USAGE prev. SQL_CATALOG_USAGE: Indicates the SQL statements that might refer to qualifiers. |
Returns SQL_CU_DML_STATEMENTS. Catalog names can be used in SELECT, INSERT, UPDATE, DELETE, SELECT FOR UPDATE, and positioned UPDATE and DELETE statements. |
SQL_QUALIFIER_USAGE Now SQL_CATALOG_USAGE: Identifies DML statements that support qualifier names. |
Returns SQL_CU_DML_STATEMENTS. Qualifiers can be used in all DML statements (SELECT, INSERT, UPDATE, DELETE, SELECT FOR UPDATE). |
SQL_QUOTED_IDENTIFIER_CASE: Indicates case sensitivity of quoted identifiers. |
Returns SQL_IC_SENSITIVE. Quoted identifiers are case sensitive. |
SQL CATALOG_NAME_SEPARATOR prev. SQL_QUALIFIER_NAME_SEPARATOR: The character that separates the name qualifier from the name element. |
Returns '.'. The '.' character is used as a separator in qualified names. |
SQL_QUALIFIER_TERM: The term used to describe a qualifier. |
Returns catalog |
SQL_QUALIFIER_LOCATION: The position of the qualifier in a qualified table name. |
Returns SQL_CL_START. The qualifier precedes the table name in a qualified table name. |
SQL_ROW_UPDATES: Indicates if keyset-driven or mixed cursors maintain row versions or values. |
Returns Y. Cursors maintain values for all fetched rows and can detect updates to the row values. |
SQL_SCHEMA_TERM: The term used to describe a schema. |
Returns schema. |
SQL_SCHEMA_USAGE: Indicates the SQL statements that might refer to schemas. |
Returns SQL_OU_DML_STATEMENTS, SQL_OU_TABLE_DEFINITION, SQL_OU_INDEX_DEFINITION, SQL_OU_PRIVILEGE_DEFINITION. |
SQL_SCROLL_CONCURRENCY: Indicates the cursor concurrency control options supported by the server. |
Returns SQL_SCCO_READ_ONLY, SQL_SCCO_OPT_ROWVER. |
SQL_SCROLL_OPTIONS: Indicates the cursor scroll options supported by the server. |
Returns SQL_SO_FORWARD_ONLY, SQL_SO_KEYSET_DRIVEN, SQL_SO_STATIC. |
SQL_SEARCH_PATTERN_ESCAPE: The escape character that allows use of the wildcard characters % and _ in search patterns. |
Returns ''. The '' character is used as an escape character for the '%' and '_' characters in search patterns. |
SQL_SERVER_NAME: Indicates the name of the host. |
The returned value is determined by connection properties. |
SQL_SPECIAL_CHARACTERS: Indicates any special characters allowed in identifier names. |
Returns _. The underscore character is allowed in identifier names. |
SQL_SQL_CONFORMANCE: Indicates the level of SQL-92 compliance. |
Returns SQL_SC_SQL92_ENTRY. The driver is SQL92 entry-level compliant. |
SQL_SQL92_DATETIME_FUNCTIONS: Lists the datetime functions supported by the server. |
Returns SQL_SDF_CURRENT_DATE, SQL_SDF_CURRENT_TIME, SQL_SDF_CURRENT_TIMESTAMP. |
SQL_SQL92_FOREIGN_KEY_DELETE_RULE: Indicates the server-enforced rules for using a foreign key in a DELETE statement. |
Returns SQL_SFKD_CASCADE, SQL_SFKD_NO_ACTION, SQL_SFKD_SET_DEFAULT, SQL_SFKD_SET_NULL. |
SQL_SQL92_FOREIGN_KEY_UPDATE_RULE: Indicates the server-enforced rules for using a foreign key in an UPDATE statement. |
Returns SQL_SFKU_CASCADE, SQL_SFKU_NO_ACTION, SQL_SFKU_SET_DEFAULT, SQL_SFKU_SET_NULL. |
SQL_SQL92_GRANT: Indicates the supported GRANT statement clauses. |
Returns SQL_SG_DELETE_TABLE, SQL_SG_INSERT_TABLE, SQL_SG_REFERENCES_TABLE, SQL_SG_SELECT_TABLE, SQL_SG_UPDATE_TABLE. |
SQL_SQL92_NUMERIC_VALUE_FUNCTIONS: Lists the scalar numeric functions supported by the server and driver. |
Returns SQL_SNVF_BIT_LENGTH, SQL_SNVF_CHAR_LENGTH, SQL_SNVF_CHARACTER_LENGTH, SQL_SNVF_EXTRACT, SQL_SNVF_OCTET_LENGTH, SQL_SNVF_POSITION. |
SQL_SQL92_PREDICATES, Identifies the predicates of a SELECT statement supported by the server. |
Returns SQL_SP_EXISTS, SQL_SP_ISNOTNULL, SQL_SP_ISNULL, SQL_SP_OVERLAPS, SQL_SP_LIKE, SQL_SP_IN, SQL_SP_BETWEEN, SQL_SP_COMPARISON, SQL_SP_QUANTIFIED_COMPARISON. |
SQL_SQL92_RELATIONAL_JOIN_OPERATORS: Identifies the relational join operators supported by the server. |
Returns SQL_SRJO_CROSS_JOIN, SQL_SRJO_EXCEPT_JOIN, SQL_SRJO_FULL_OUTER_JOIN, SQL_SRJO_INNER_JOIN, SQL_SRJO_INTERSECT_JOIN, SQL_SRJO_LEFT_OUTER_JOIN, SQL_SRJO_NATURAL_JOIN, SQL_SRJO_RIGHT_OUTER_JOIN, SQL_SRJO_UNION_JOIN. |
SQL_SQL92_REVOKE: Identifies the clauses in a REVOKE statement that are supported by the server. |
Returns SQL_SR_DELETE_TABLE, SQL_SR_INSERT_TABLE, SQL_SR_REFERENCES_TABLE, SQL_SR_SELECT_TABLE, SQL_SR_UPDATE_TABLE. |
SQL_SQL92_ROW_VALUE_CONSTRUCTOR: Indicates the row value constructor expressions in a SELECT statement that are supported by the server. |
Returns SQL_SRVC_VALUE_EXPRESSION, SQL_SRVC_NULL. |
SQL_SQL92_STRING_FUNCTIONS: Lists the string scalar functions supported by the server and driver. |
Returns SQL_SSF_CONVERT, SQL_SSF_LOWER, SQL_SSF_UPPER, SQL_SSF_SUBSTRING, SQL_SSF_TRANSLATE, SQL_SSF_TRIM_BOTH, SQL_SSF_TRIM_LEADING, SQL_SSF_TRIM_TRAILING. |
SQL_SQL92_VALUE_EXPRESSIONS: Indicates the value expressions supported by the server. |
Returns SQL_SVE_CASE, SQL_SVE_CAST, SQL_SVE_COALESCE, SQL_SVE_NULLIF. |
SQL_STANDARD_CLI_CONFORMANCE: Indicates the CLI standard the driver conforms to. |
This info_type is currently unsupported. |
SQL_STATIC_CURSOR_ATTRIBUTES1: Describes the first set of static cursor attributes supported by the driver. |
Returns SQL_CA1_NEXT, SQL_CA1_ABSOLUTE, SQL_CA1_RELATIVE, SQL_CA1_BOOKMARK, SQL_CA1_LOCK_NO_CHANGE, SQL_CA1_POS_POSITION, SQL_CA1_POS_UPDATE, SQL_CA1_POS_DELETE, SQL_CA1_POS_REFRESH, SQL_CA1_BULK_ADD, SQL_CA1_BULK_UPDATE_BY_BOOKMARK, SQL_CA1_BULK_DELETE_BY_BOOKMARK, SQL_CA1_BULK_FETCH_BY_BOOKMARK. |
SQL_STATIC_CURSOR_ATTRIBUTES2: Describes the second set of static cursor attributes supported by the driver. |
Returns SQL_CA2_READ_ONLY_CONCURRENCY, SQL_CA2_OPT_ROWVER_CONCURRENCY, SQL_CA2_SENSITIVITY_ADDITIONS, SQL_CA2_SENSITIVITY_DELETIONS, SQL_CA2_SENSITIVITY_UPDATES, SQL_CA2_CRC_EXACT. |
SQL_STATIC_SENSITIVITY: Indicates whether changes made to a static cursor by SQLSetPos() or UPDATE or DELETE statements are detected by the application. |
Returns SQL_SS_ADDITIONS, SQL_SS_DELETIONS, SQL_SS_UPDATES. |
SQL_STRING_FUNCTIONS: Lists the scalar string functions supported by the server and driver. |
Returns SQL_FN_STR_CONCAT, SQL_FN_STR_LTRIM, SQL_FN_STR_LENGTH, SQL_FN_STR_LOCATE, SQL_FN_STR_LCASE, SQL_FN_STR_RTRIM, SQL_FN_STR_SUBSTRING, SQL_FN_STR_UCASE. |
SQL_SUBQUERIES: Identifies the subquery predicates to a SELECT statement supported by the server. |
Returns SQL_SQ_COMPARISON, SQL_SQ_EXISTS, SQL_SQ_IN, SQL_SQ_QUANTIFIED. |
SQL_SYSTEM_FUNCTIONS: Lists the scalar system functions supported by the server and driver. |
Returns 0. |
SQL_TABLE_TERM: The term used to describe a table. |
Returns table. |
SQL_TIMEDATE_ADD_INTERVALS: Indicates the timestamp intervals supported by the server for the TIMESTAMPADD scalar function. |
Returns 0. |
SQL_TIMEDATE_DIFF_INTERVALS: Indicates the timestamp intervals supported by the server for the TIMESTAMPDIFF scalar function. |
Returns 0. |
SQL_TIMEDATE_FUNCTIONS: Indicates the date and time functions supported by the server. |
Returns SQL_FN_TD_NOW, SQL_FN_TD_CURDATE, SQL_FN_TD_CURTIME. |
SQL_TXN_CAPABLE: Identifies the transaction support offered by the server and driver. |
Returns SQL_TC_ALL. Transactions can contain both DML and DDL statements. |
SQL_TXN_ISOLATION_OPTION: Indicates the transaction isolation level supported by the server. |
Returns SQL_TXN_READ_COMMITTED, SQL_TXN_SERIALIZABLE. |
SQL_UNION: Indicates server support for the UNION clause. |
Returns SQL_U_UNION, SQL_U_UNION_ALL. |
SQL_USER_NAME: Identifies the name of the user connected to a database. Can be different than the login name. |
This value is determined by the connection properties. |
SQL_XOPEN_CLI_YEAR: The publication year of the X/Open specification that the driver manager complies with. |
This info_type is currently unsupported. |
接続属性¶
ODBC SQLGetConnectAttr() および SQLSetConnectAttr()
関数を使用して、接続属性の値を取得または設定できます。
SQLGetConnectAttr()¶
SQLGetConnectAttr()
ファンクションは、接続属性の現在の値を返します。シグネチャは次のとおりです。
SQLRETURN SQLGetConnectAttr
(
SQLHDBC conn_handle, //Input
SQLINTEGER attribute, //Input
SQLPOINTER value_pointer, //Output
SQLINTEGER buffer_length, //Input
SQLINTEGER * string_length_pointer //Output
);
conn_handle—接続ハンドル。attribute—値を取得する属性を識別します。value_pointer—attribute値を受け取るメモリの場所へのポインタ。buffer_length—attributeがODBCによって定義され、value_pointerが文字の並びまたはバイナリバッファーを指す場合、buffer_lengthはvalue_pointerの長さです。value_pointerが固定サイズの値(整数など)を指している場合、buffer_lengthは無視されます。
EDB- ODBCが属性を定義する場合、 SQLGetConnectAttr() は
buffer_length パラメータを設定します。 buffer_length
は次のいずれかです。
Value type |
Meaning |
|---|---|
Character string |
The length of the character string |
Binary buffer |
The result of SQL_LEN_BINARY_ATTR(length) |
Fixed length data type |
SQL_IS_INTEGER or SQL_IS_UINTEGER |
Any other type |
SQL_IS_POINTER |
string_length_pointer—value_pointerで結果バイト数を受け取るSQLINTEGERへのポインタ。value_pointerがNULLの場合、string_length_pointerは返されません。
このファンクションは、 SQL_SUCCESS 、 SQL_SUCCESS_WITH_INFO 、
SQL_NO_DATA 、 SQL_ERROR 、または SQL_INVALID_HANDLE
を返します。
次の表に、 EDB- ODBCでサポートされる接続属性を示します。
Attribute |
Supported? |
Notes |
|---|---|---|
SQL_ATTR_ACCESS_MODE |
No |
SQL_MODE_READ_WRITE |
SQL_ATTR_ASYNC_ENABLE |
No |
SQL_ASYNC_ENABLE_OFF |
SQL_ATTR_AUTO_IPD |
No |
|
SQL_ATTR_AUTOCOMMIT |
Yes |
SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON, SQL_AUTOCOMMIT_OFF |
SQL_ATTR_CONNECTION_TIMEOUT |
No |
|
SQL_ATTR_CURRENT_CATALOG |
No |
|
SQL_ATTR_DISCONNECT_BEHAVIOR |
No |
|
SQL_ATTR_ENLIST_IN_DTC |
Yes |
For win32 and with conditional compilation |
SQL_ATTR_ENLIST_IN_XA |
No |
|
SQL_ATTR_LOGIN_TIMEOUT |
No |
SQL_LOGIN_TIMEOUT |
SQL_ATTR_ODBC_CURSORS |
No |
|
SQL_ATTR_PACKET_SIZE |
No |
|
SQL_ATTR_QUIET_MODE |
No |
|
SQL_ATTR_TRACE |
No |
|
SQL_ATTR_TRACEFILE |
No |
|
SQL_ATTR_TRANSLATE_LIB |
No |
|
SQL_ATTR_TRANSLATE_OPTION |
No |
|
SQL_ATTR_TXN_ISOLATION |
Yes |
SQL_TXN_ISOLATION, SQL_DEFAULT_TXN_ISOLATION |
SQLSetConnectAttr()¶
ODBC SQLSetConnectAttr()
ファンクションを使用して、接続属性の値を設定できます。ファンクションのシグネチャは次のとおりです。
SQLRETURN SQLSetConnectAttr
(
SQLHDBC conn_handle , // Input
SQLINTEGER attribute , // Input
SQLPOINTER value_pointer , // Input
SQLINTEGER string_length , // Input
);
conn_handle—接続ハンドル。attribute—値を設定する属性を識別します。value_pointer—属性が想定する値へのポインタ。string_length—attributeがODBCによって定義され、value_pointerがバイナリバッファまたは文字の並びを指す場合、string_lengthはvalue_pointerの長さです。value_pointerが固定長の値(整数など)を指している場合、string_lengthは無視されます。
EDB- ODBCが属性を定義する場合、アプリケーションは string_length
パラメータを設定します。可能な string_length 値を表に示します。
Value type |
Meaning |
|---|---|
Character string |
The length of the character string or SQL_NTS |
Binary buffer |
The result of SQL_LEN_BINARY_ATTR(length) |
Fixed length data type |
SQL_IS_INTEGER or SQL_IS_UINTEGER |
Any other type |
SQL_IS_POINTER |
SQLSetConnectAttr() は、 SQL_SUCCESS 、
SQL_SUCCESS_WITH_INFO 、 SQL_ERROR 、 SQL_STILL_EXECUTING
または SQL_INVALID_HANDLE を返します。
接続ハンドルが割り当てられた後はいつでも、 SQLFreeHandle()
の呼び出しで接続が閉じられるまで、 SQLSetConnectAttr()
を呼び出すことができます。呼び出しによって設定されたすべての属性は、
SQLFreeHandle() の呼び出しまで保持されます。
接続属性には、設定可能な特定の時間枠があります。一部の属性は接続が確立される前に設定する必要がありますが、他の属性は接続が確立された後にのみ設定できます。
次の表は、接続属性とそれらを設定できる時間フレームを示しています。
Attribute |
Set before or after establishing a connection? |
|---|---|
SQL_ATTR_ACCESS_MODE |
Before or after |
SQL_ATTR_ASYNC_ENABLE |
Before or after |
SQL_ATTR_AUTO_IPD |
Before or after |
SQL_ATTR_AUTOCOMMIT |
Before or after |
SQL_ATTR_CONNECTION_TIMEOUT |
Before or after |
SQL_ATTR_CURRENT_CATALOG |
Before or after |
SQL_ATTR_ENLIST_IN_DTC |
After |
SQL_ATTR_ENLIST_IN_XA |
After |
SQL_ATTR_LOGIN_TIMEOUT |
Before |
SQL_ATTR_ODBC_CURSORS |
Before |
SQL_ATTR_PACKET_SIZE |
Before |
SQL_ATTR_QUIET_MODE |
Before or after |
SQL_ATTR_TRACE |
Before or after |
SQL_ATTR_TRACEFILE |
Before or after |
SQL_ATTR_TRANSLATE_LIB |
After |
SQL_ATTR_TRANSLATE_OPTION |
After |
SQL_ATTR_TXN_ISOLATION |
Before or after |
環境属性¶
ODBC SQLGetEnvAttr() および SQLSetEnvAttr()
関数を使用して、環境属性の値を取得または設定できます。
SQLGetEnvAttr()¶
SQLGetEnvAttr()
ファンクションを使用して、システムの環境属性の現在の値を見つけます。ファンクションのシグネチャは次のとおりです。
SQLRETURN SQLGetConnectAttr
(
SQLHDBC env_handle, // Input
SQLINTEGER attribute, // Input
SQLPOINTER value_ptr, // Output
SQLINTEGER buffer_length, // Input
SQLINTEGER * string_length_pointer // Output
);
env_handle—環境ハンドル。attribute—値を取得する属性を識別します。value_pointer—attribute値を受け取るメモリの場所へのポインタ。buffer_length—属性が文字の並びの場合、buffer_lengthはvalue_ptrの長さです。属性の値が文字の並びでない場合、buffer_lengthは使用されません。string_length_pointer—value_pointerで結果バイト数を受け取るSQLINTEGERへのポインタ。value_pointerがNULLの場合、string_length_pointerは返されません。
このファンクションは、 SQL_SUCCESS 、 SQL_SUCCESS_WITH_INFO 、
SQL_NO_DATA 、 SQL_ERROR 、または SQL_INVALID_HANDLE
を返します。
次の表に、 EDB- ODBCでサポートされる環境属性を示します。
Attribute |
Supported? |
Restrictions? |
|---|---|---|
SQL_ATTR_CONNECTION_POOLING |
SQL_CP_ONE_PER_DRIVER or SQL_CP_OFF |
Determined by connection properties |
SQL_ATTR_ODBC_VERSION |
(SQL_OV_ODBC3), (SQL_OV_ODBC2) |
None |
SQL_ATTR_OUTPUT_NTS |
SQL_SUCCESS |
None |
SQLSetEnvAttr()¶
SQLSetEnvAttr()
ファンクションを使用して、環境属性の値を設定できます。ファンクションのシグネチャは次のとおりです。
SQLRETURN SQLSetEnvAttr
(
SQLHENV env_handle , //Input
SQLINTEGER attribute , //Input
SQLPOINTER value_pointer , //Input
SQLINTEGER string_length //Input
);
env_handle—環境ハンドル。attribute—値を設定する属性を識別します。value_pointer—属性に割り当てられた値へのポインタ。値は、指定された属性に応じて、NULLで終了文字の並びまたは32ビット整数値です。string_length—value_pointerがバイナリバッファまたは文字の並びへのポインタの場合、string_lengthはvalue_pointerの長さです。属性に割り当てられる値が文字の場合、string_lengthはその文字の並びの長さです。value_pointerがNULLの場合、string_lengthは返されません。value_pointerが整数の場合、string_lengthは無視されます。
SQLSetEnvAttr() は、 SQL_SUCCESS 、 SQL_INVALID_HANDLE 、
SQL_ERROR 、または SQL_SUCCESS_WITH_INFO
を返します。アプリケーションは、接続ハンドルを割り当てる前に
SQLSetEnvAttr()
を呼び出す必要があります。環境属性に適用されるすべての値は、接続に対して
SQLFreeHandle() が呼び出されるまで持続します。
ODBCバージョン3.xでは、マルチプルの環境ハンドルを同時に割り当てることができます。
次の表に、 SQLSetAttr() で設定できる環境属性を示します。
Attribute |
Value_pointer type |
Restrictions? |
|---|---|---|
SQL_ATTR_ODBC_VERSION |
32-bit integer |
Set this attribute before the application calls any function that includes an SQLHENV argument. |
SQL_ATTR_OUTPUT_NTS |
32-bit integer |
Defaults to SQL_TRUE. Calls that set this attribute to SQL_FALSE return SQL_ERROR/SQLSTATEHYC00 (feature not implemented). |
ステートメント属性¶
ODBC SQLGetStmtAttr() および SQLSetStmtAttr()
関数を使用して、ステートメント属性の値を取得および設定できます。
SQLGetStmtAttr()¶
SQLGetStmtAttr()
ファンクションは、ステートメント属性の現在の値を返します。シグネチャは次のとおりです。
SQLRETURN SQLGetConnectAttr
(
SQLHDBC stmt_handle, //Input
SQLINTEGER attribute, //Input
SQLPOINTER value_ptr, //Output
SQLINTEGER buffer_length, //Input
SQLINTEGER * string_length_pointer //Output
);
stmt_handle—文ハンドル。attribute—属性値。value_pointer—attribute値を受け取るメモリの場所へのポインタ。buffer_length—属性がODBCによって定義されている場合、buffer_lengthはvalue_pointerの長さです(value_pointerが文字の並びまたはバイナリバッファーを指している場合)。value_pointerが整数を指す場合、buffer_lengthは無視されます。
EDB- ODBCが属性を定義する場合、アプリケーションは buffer_length
パラメータを設定します。 buffer_length は次のいずれかです。
Value type |
Meaning |
|---|---|
Character string |
The length of the character string |
Binary buffer |
The result of SQL_LEN_BINARY_ATTR(length) |
Fixed length data type |
SQL_IS_INTEGER or SQL_IS_UINTEGER |
Any other type |
SQL_IS_POINTER |
string_length_pointer—要求された値を保持するために必要なバイト数を受け取るSQLINTEGERへのポインタ。value_pointerがNULLの場合、string_length_pointerは返されません。
このファンクションは、 SQL_SUCCESS 、 SQL_SUCCESS_WITH_INFO 、
SQL_ERROR 、または SQL_INVALID_HANDLE を返します。
Attribute |
Supported? |
Restrictions? |
|---|---|---|
SQL_ATTR_APP_PARAM_DESC |
Yes |
|
SQL_ATTR_APP_ROW_DESC |
Yes |
|
SQL_ATTR_ASYNC_ENABLE |
No |
|
SQL_ATTR_CONCURRENCY |
Yes |
SQL_CONCUR_READ_ONLY |
SQL_ATTR_CURSOR_SCROLLABLE |
Yes |
|
SQL_ATTR_CURSOR_TYPE |
Yes |
SQL_CURSOR_FORWARD_ONLY |
SQL_ATTR_CURSOR_SENSITIVITY |
Yes |
SQL_INSENSITIVE |
SQL_ATTR_ENABLE_AUTO_IPD |
No |
|
SQL_ATTR_FETCH_BOOKMARK_PTR |
Yes |
|
SQL_ATTR_IMP_PARAM_DESC |
Yes |
|
SQL_ATTR_IMP_ROW_DESC |
Yes |
|
SQL_ATTR_KEYSET_SIZE |
No |
|
SQL_ATTR_MAX_LENGTH |
No |
|
SQL_ATTR_MAX_ROWS |
No |
|
SQL_ATTR_METADATA_ID |
Yes |
|
SQL_ATTR_NOSCAN |
No |
|
SQL_ATTR_PARAM_BIND_OFFSET_PTR |
Yes |
ODBC V2.0 |
SQL_ATTR_PARAM_BIND_TYPE |
Yes |
|
SQL_ATTR_PARAM_OPERATION_PTR |
Yes |
|
SQL_ATTR_PARAM_STATUS_PTR |
Yes |
|
SQL_ATTR_PARAMS_PROCESSED_PTR |
Yes |
|
SQL_ATTR_PARAMSET_SIZE |
Yes |
|
SQL_ATTR_QUERY_TIMEOUT |
No |
|
SQL_ATTR_RETRIEVE_DATA |
No |
|
SQL_ATTR_ROW_BIND_OFFSET_PTR |
Yes |
|
SQL_ATTR_ROW_BIND_TYPE |
No |
|
SQL_ATTR_ROW_NUMBER |
Yes |
|
SQL_ATTR_ROW_OPERATION_PTR |
Yes |
|
SQL_ATTR_ROW_STATUS_PTR |
Yes |
|
SQL_ATTR_ROWS_FETCHED_PTR |
Yes |
|
SQL_ATTR_ROW_ARRAY_SIZE |
Yes |
|
SQL_ATTR_SIMULATE_CURSOR |
No |
|
SQL_ATTR_USE_BOOKMARKS |
Yes |
|
SQL_ROWSET_SIZE |
Yes |
SQLSetStmtAttr()¶
SQLSetStmtAttr()
ファンクションを使用して、環境属性の値を設定できます。シグネチャは次のとおりです。
SQLRETURN SQLSetStmtAttr
(
SQLHENV stmt_handle , //Input
SQLINTEGER attribute , //Input
SQLPOINTER value_pointer , //Input
SQLINTEGER string_length //Input
);
stmt_handle—環境ハンドル。attribute—値を設定するステートメント属性を識別します。value_pointer—属性に割り当てられた値を保持するメモリの場所へのポインタ。value_pointerは、以下へのポインタにすることができます。nullで終わる文字の並び-バイナリバッファー-ドライバによって定義された値-
SQLLEN、SQLULEN、またはSQLUSMALLINT型の値
value-pointer
は、オプションで次の値のいずれかを保持することもできます。-
ODBCディスクリプタハンドル- SQLUINTEGER 値- SQLULEN
値-署名されたINTEGER(属性がドライバー固有の値の場合)
string_length—attributeがODBCによって定義され、value_pointerがバイナリバッファーまたは文字の並びを指す場合、string_lengthはvalue_pointerの長さです。value_pointerが整数を指す場合、string_lengthは無視されます。 EDB- ODBCが属性を定義する場合、アプリケーションはstring_lengthパラメータを設定します。可能なstring_length値は次のとおりです。
Value type |
Meaning |
|---|---|
Character string |
The length of the character string or SQL_NTS |
Binary buffer |
The result of SQL_LEN_BINARY_ATTR(length) |
Fixed length data type |
SQL_IS_INTEGER or SQL_IS_UINTEGER |
Any other type |
SQL_IS_POINTER |
エラーハンドリング¶
ODBC SQLGetDiagRec()
ファンクションを使用して、これらのODBC関数の診断情報を取得できます。
SQLGetDiagRec()¶
SQLGetDiagRec()
ファンクションは、属性値を取得または設定するODBC関数によって書き込まれた診断レコードからステータスとエラー情報を返します。シグネチャは次のとおりです。
SQLRETURN SQLGetDiagRec
(
SQLSMALLINT handle_type, // Input
SQLHANDLE handle, // Input
SQLSMALLINT record_number, // Input
SQLCHAR *SQLState_pointer, // Output
SQLINTEGER *native_error_pointer, // Output
SQLCHAR *error_text_pointer, // Output
SQLSMALLINT buffer_length, // Input
SQLSMALLINT *text_length_pointer // Output
);
handle_type—handle引数のハンドルタイプ。handle_typeは次のいずれかでなければなりません。SQL_HANDLE_ENVは環境ハンドルを指定します。 -SQL_HANDLE_STMTは、ステートメントハンドルを指定します。 -SQL_HANDLE_DBCは、接続ハンドルを指定します。 -SQL_HANDLE_DESCは、ディスクリプタハンドルを指定します。handle—属性エラーメッセージに関連付けられたハンドル。record_number—アプリケーションが情報を探しているステータスレコード(1以上である必要があります)。SQLState_pointer—レコードからSQLStateエラーコードを受け取るメモリバッファへのポインタ。native_error_pointer—データソースのネイティブエラーメッセージを受信するバッファーへのポインター(SQL_DIAG_NATIVEフィールドに含まれる)。error_text_pointer—エラーテキスト(SQL_DIAG_MESSAGE_TEXTフィールドに含まれる)を受信するメモリバッファへのポインタ。buffer_length—error_textバッファーの長さ。text_length_pointer—error_text_pointerフィールドのサイズ(文字数)を受け取るバッファーへのポインター。error_text_pointerパラメータの文字数が使用可能な数(buffer_length内)を超える場合、error_text_pointerは切り捨てられます。
SQLGetDiagRec() は、 SQL_SUCCESS 、 SQL_ERROR 、
SQL_INVALID_HANDLE 、 SQL_SUCCESS_WITH_DATA または
SQL_NO_DATA を返します。
サポートされているODBC API関数¶
次の表に、 ODBC API関数を示します。 APIがEDB-
ODBCドライバによってサポートされている場合、右の列はYesを指定します。
ODBC SQLGetFunctions() ファンクション(ファンクションID
SQL_API_ODBC3_ALL_FUNCTIONS
を指定)を使用して、このリストの現在のバージョンを結果ます。
ODBC API function name |
Supported by EDB-ODBC? |
|---|---|
SQLAllocConnect() |
Yes |
SQLAllocEnv() |
Yes |
SQLAllocStmt() |
Yes |
SQLBindCol() |
Yes |
SQLCancel() |
Yes |
SQLColAttributes() |
Yes |
SQLConnect() |
Yes |
SQLDescribeCol() |
Yes |
SQLDisconnect() |
Yes |
SQLError() |
Yes |
SQLExecDirect() |
Yes |
SQLExecute() |
Yes |
SQLFetch() |
Yes |
SQLFreeConnect() |
Yes |
SQLFreeEnv() |
Yes |
SQLFreeStmt() |
Yes |
SQLGetCursorName() |
Yes |
SQLNumResultCols() |
Yes |
SQLPrepare() |
Yes |
SQLRowCount() |
Yes |
SQLSetCursorName() |
Yes |
SQLSetParam() |
Yes |
SQLTransact() |
Yes |
SQLColumns() |
Yes |
SQLDriverConnect() |
Yes |
SQLGetConnectOption() |
Yes |
SQLGetData() |
Yes |
SQLGetFunctions() |
Yes |
SQLGetInfo() |
Yes |
SQLGetStmtOption() |
Yes |
SQLGetTypeInfo() |
Yes |
SQLParamData() |
Yes |
SQLPutData() |
Yes |
SQLSetConnectOption() |
Yes |
SQLSetStmtOption() |
Yes |
SQLSpecialColumns() |
Yes |
SQLStatistics() |
Yes |
SQLTables() |
Yes |
SQLBrowseConnect() |
No |
SQLColumnPrivileges() |
No |
SQLDataSources() |
Yes |
SQLDescribeParam() |
No |
SQLExtendedFetch() |
Yes |
SQLForeignKeys() |
Yes |
SQLMoreResults() |
Yes |
SQLNativeSQL() |
Yes |
SQLNumParams() |
Yes |
SQLParamOptions() |
Yes |
SQLPrimaryKeys() |
Yes |
SQLProcedureColumns() |
Yes |
SQLProcedures() |
Yes |
SQLSetPos() |
Yes |
SQLSetScrollOptions() |
No |
SQLTablePrivileges() |
Yes |
SQLDrivers() |
Yes |
SQLBindParameter() |
Yes |
SQLAllocHandle() |
Yes |
SQLBindParam() |
Yes |
SQLCloseCursor() |
Yes |
SQLColAttribute() |
Yes |
SQLCopyDesc() |
Yes |
SQLendTran() |
Yes |
SQLFetchScroll() |
Yes |
SQLFreeHandle() |
Yes |
SQLGetConnectAttr() |
Yes |
SQLGetDescField() |
Yes |
SQLGetDescRec() |
Yes |
SQLGetDiagField() |
Yes |
SQLGetDiagRec() |
Yes |
SQLGetEnvAttr() |
Yes |
SQLGetStmtAttr() |
Yes |
SQLSetConnectAttr() |
Yes |
SQLSetDescField() |
Yes |
SQLSetDescRec() |
No |
SQLSetEnvAttr() |
Yes |
SQLSetStmtAttr() |
Yes |
SQLBulkOperations() |
Yes |
サポートされているデータ型¶
EDB- ODBCは、次のODBCデータ型をサポートしています。
ODBC data type |
Corresponding EDB Postgres Advanced Server data type |
|---|---|
SQL_BIGINT |
PG_TYPE_INT8 |
SQL_BINARY |
PG_TYPE_BYTEA |
SQL_BIT |
PG_TYPE_BOOL or PG_TYPE_CHAR |
SQL_CHAR |
PG_TYPE_BPCHAR |
SQL_TYPE_DATE |
PG_TYPE_DATE |
SQL_DECIMAL |
PG_TYPE_NUMERIC |
SQL_DOUBLE |
PG_TYPE_FLOAT8 |
SQL_FLOAT |
PG_TYPE_FLOAT8 |
SQL_INTEGER |
PG_TYPE_INT4 |
SQL_LONGVARBINARY |
PG_TYPE_BYTEA |
SQL_LONGVARCHAR |
PG_TYPE_VARCHAR or PG_TYPE_TEXT |
SQL_NUMERIC |
PG_TYPE_NUMERIC |
SQL_NUMERIC |
PG_TYPE_NUMERIC |
SQL_REAL |
PG_TYPE_FLOAT4 |
SQL_SMALLINT |
PG_TYPE_INT2 |
SQL_TYPE_TIME |
PG_TYPE_TIME |
SQL_TYPE_TIMESTAMP |
PG_TYPE_DATETIME |
SQL_TINYINT |
PG_TYPE_INT2 |
SQL_VARBINARY |
PG_TYPE_BYTEA |
SQL_VARCHAR |
PG_TYPE_VARCHAR |
ADOユーザーの前提条件¶
Command.Execute を実行前に、 Command.Prepared = True
を実行する必要があります。
スレッドセーフ¶
EDB- ODBCはスレッドセーフです。