solidDB Help : solidDB reference : ODBC: Data types : Transfer octet length
  
Transfer octet length
When data is transferred to its default C data type, an application receives a maximum number of bytes. This maximum is known as the transfer octet length of a column.
For character data, space for the null-termination character is not included in the transfer octet length. Note that the transfer octet length in bytes can differ from the number of bytes needed to store the data on the data source.
The following table details the ODBC functions that return parameter decimal attributes in an SQL statement data type or decimal attributes on a data source:
 
ODBC function
Returns
SQLColumns
Transfer octet length of a column in specified tables (such as the base table, view, or a system table).
SQLColAttribute
Transfer octet length of columns at the data source.
SQLProcedureColumns
Transfer octet length of a column in a procedure.
The values returned by ODBC functions for the transfer octet length might not correspond to the values returned in SQL_DESC_LENGTH. For all character and binary types, the values come from the SQL_DESC_OCTET_LENGTH of a descriptor field. For other data types, there is no descriptor field that stores this information.
Descriptor fields describe the characteristics of a result set. They do not contain valid data values before statement execution. In its result set, SQLColAttribute returns the transfer octet length of columns at the data source; these values might not match the values in the SQL_DESC_OCTET_LENGTH descriptor fields. For more information about descriptor fields, see SQLSetDescField function description on the Microsoft ODBC Web site.
Each concise SQL data type has the following transfer octet length definition as noted in the following table:
 
SQL type identifier
Transfer octet length
All character and binary types (1)
The defined or the maximum (for variable type) length of the column in bytes. This value matches the one in the SQL_DESC_OCTET_LENGTH descriptor field.
SQL_DECIMAL SQL_NUMERIC
The number of bytes required to hold the character representation of this data if the character set is ASCII, and twice this number if the character set is UNICODE. The character representation is the maximum number of digits plus two; the data is returned as a character string, where the characters are needed for digits, a sign, and a decimal point. For example, the transfer length of a column defined as NUMERIC(10,3) is 12 because there are 10 bytes for the digits, 1 byte for the sign, and 1 byte for the decimal point.
SQL_TINYINT
1
SQL_SMALLINT
2
SQL_INTEGER
4
SQL_BIGINT
The number of bytes required to hold the character representation of this data if the character set is ASCII, and twice this number if the character set is UNICODE. This data type is returned as a character string by default. The character representation consists of 20 characters for 19 digits and a sign (if signed), or 20 digits (if unsigned). The length is 20.
solidDB supports only signed, not unsigned, BIGINT.
SQL_REAL
4
SQL_FLOAT
8
SQL_DOUBLE
8
All binary types (1)
The number of bytes required to store the defined (for fixed types) or maximum (for variable types) number of characters.
SQL_TYPE_DATE SQL_TYPE_TIME
6 (size of the structures SQL_DATE_STRUCT or SQL_TIME_STRUCT).
SQL_TYPE_TIMESTAMP
16 (size of the structure SQL_TIMESTAMP_STRUCT).
1 SQL_NO_TOTAL is returned when the driver cannot determine the column or parameter length for variable types.
Go up to
ODBC: Data types