What's New
The following data types are available with DB2 Universal
Database Version 5.2 and can be used with the call level interface
(CLI):
The following tables are updated in the CLI Guide and Reference as a result
of the added support for the BIGINT data type. See the SQL Reference for more information on this new data type.
- Table 3, "SQL Symbolic and Default Data Types":
-
- SQL Data Type: BIGINT
- Symbolic SQL Data Type: SQL_BIGINT
- Default Symbolic C Data Type: SQL_C_BIGINT
- Table 4, "C Data Types":
-
- C Symbolic Data Type: SQL_C_BIGINT
- C Type: SQLBIGINT
- Base C Type: long int (or __int64)
- Table 22, "SQLBindParameter Arguments", under
SQLBindParameter():
-
- Add SQL_C_BIGINT to the row for argument "ValueType".
- Add SQL_BIGINT to the row for argument "ParameterType".
- Table 116, "SQLGetTypeInfo Arguments, under
SQLGetTypeInfo():
- Add SQL_BIGINT to the list of supported types for argument
"DataType".
The following additions apply to Chapter 2. Writing a DB2 CLI
Application of the CLI Guide and Reference as a result of support for the new DATALINK data type.
Three tables require an extra row each:
- Table 3. SQL Symbolic and Default Data Types
-
- SQL Data Type field: DATALINK
- Symbolic SQL Data Type field: SQL_DATALINK
- Default Symbolic C Data Type: SQL_C_DATALINK
- Table 4. C Data Types
-
- C Symbolic Data Type field: SQL_C_DATALINK
- C Type field: SQLCHAR
- Base C type field: unsigned char
- Table 7. Supported Data Conversions
- The SQL Data Type SQLDATALINK only converts with SQL_C_DATALINK.
The following section is added to Chapter 3. Using Advanced
Features.
In addition to the distinct types, user defined structured types can also
be defined and used as the type for a table or view. Tables or views
that are defined using a structured type are called typed tables or
typed views. Structured types can be defined in a hierarchy
with subtypes and supertypes. These structured types
are created using the CREATE TYPE statement. Rows of a typed table or
view are identified with an object identifier (OID) that is a reference
type. A reference type is defined to have a target type, which must be
a structured type. When the root structured type (the structured type
without a supertype) is defined, the representation type for the reference
type is defined as based on a built-in data type. Similar to user
defined types (UDTs), a reference type shares its internal representation with
an existing type, but is considered to be a separate and incompatible type for
most operations.
Reference types provide a means of referring to rows in typed tables or
typed views. Applications continue to work with C data types for
application variables, and only need to consider the reference types when
constructing C statements.
This means:
- All SQL to C data type conversion rules that apply to the reference
type's underlying SQL built-in type apply to the reference type.
- The reference type will have the same default C Type as the underlying SQL
built-in type.
- SQLDescribeCol() will return the representation (built-in) type
information. The target type name can be obtained by calling
SQLColAttribute() with the input descriptor type set to
SQL_DESC_REFERENCE_TYPE.
- SQL predicates that involve parameter markers must be explicitly cast to
the reference type. This is required since the application can only
deal with the built-in types, so before any operation can be performed using
the parameter, it must be cast from the C built-in type to the reference type;
otherwise an error will occur when the statement is prepared.
For complete rules and a description of reference types refer to the SQL Reference.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]