LOB data types
LOB data types#
The following table shows SQL data type identifiers that support LOB:
SQL Type Identifier | Data Type | Description |
---|---|---|
SQL_BLOB | BLOB | BLOB is a binary data type with a variable length. |
SQL_CLOB | CLOB | CLOB is a character data type with a variable length. |
[Table 3‑1] Identifier of the SQL data type
The following table shows C data type identifiers that support LOB. It lists C data type of ODBC for each identifier and their definition.
C Type Identifier | ODBC C Type | C Type Definition |
---|---|---|
SQL_C_BLOB_LOCATOR | SQLUBIGINT | unsigned _int64 |
SQL_C_CLOB_LOCATOR | SQLUBIGINT | unsigned _int64 |
[Table 3‑2] Identifier for LOB-supported C data types
The name of a 64-bit integer type may vary depending on platform. The _int64 shown in the above table is the name of a 64-bit integer that is used in several platforms.
Use SQL_C_CHAR for CLOB data and SQL_C_BINARY for BLOB data to bind user variables.
To obtain a LOB locator, bind SQL_C_CLOB_LOCATOR or SQL_C_BLOB_LOCATOR appropriately based on the LOB column type. A LOB locator in this context, – a LOB location input scheme – is a handle that is used during LOB data operation like a file pointer in an operating system.
The LOB location input scheme for Read can be obtained after SELECT LOB column name FROM table where… and select are executed. The LOB location input scheme for Write can be obtained after SELECT LOB column name FROM table where… FOR UPDATE are executed.
Since a LOB location input scheme refers to LOB data at a certain point in relation to MVCC, it has the same life cycle with the transaction that has created itself. Therefore, to perform LOB operation with a LOB location input scheme, a connection should be always established in Non-Autocommit Mode.
Care must be taken as there is no LOB type of a user variable such as SQL_C_BLOB or SQL_C_CLOB.