Programmer Guide : Data types : Converting data from C to SQL data types
  
Converting data from C to SQL data types
This section provides information about converting data from C to SQL data types.
When an application calls SQLExecute or SQLExecDirect, the driver retrieves the data for any parameters bound with SQLBindParameter from storage locations in the application. For data-at-execution parameters, the application sends the parameter data with SQLPutData. If necessary, the driver converts the data from the data type specified by the ValueType argument in SQLBindParameter to the data type specified by the ParameterType argument in SQLBindParameter. Finally, the driver sends the data to the data source.
The following table shows the supported conversions from ODBC C data types to ODBC SQL data types. A solid circle indicates the default conversion for an SQL data type (the C data type from which the data will be converted when the value of ValueType or the SQL_DESC_CONCISE_TYPE descriptor field is SQL_C_DEFAULT). A hollow circle indicates a supported conversion.
The format of the converted data is not affected by the Windows country setting.
solidDB® supports only signed, not unsigned, integer data types (SQL_TINYINT, SQL_SMALLINT, SQL_INTEGER, SQL_BIGINT). You may bind an unsigned C variable to a signed SQL column, but you must make sure that the values you store fit within the range supported by both data types.
solidDB® does not support the BIT/SQL_BIT data type for SQL columns. However, you may bind a numeric SQL column to a BIT data type in your C application. For example, you may use a TINYINT column in your database and bind that column to a C variable of type SQL_C_BIT. The solidDB® ODBC driver will try to convert numeric types in the database to BIT data types for the C variables. The numeric data values must be 1 or 0 or NULL; other values cause a data conversion error. The table below does not discuss BIT/SQL_BIT data types.
Note Although the table above shows a wide range of ODBC conversions, including conversions involving unsigned data types, solidDB® supports only signed integer data types (for example, TINYINT, SMALLINT, INT, and BIGINT).
SQL_datatype where datatype is:
 
 
 
 
 
 
 
 
 
 
T
 
S
 
I
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
I
 
M
 
N
 
B
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
T
N
S
A
I
T
 
I
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
I
Y
M
L
N
E
B
G
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
N
I
A
L
T
G
I
I
 
 
 
 
 
L
 
 
 
 
 
 
 
 
 
W
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