แก้ไข

แชร์ผ่าน


SQL to C: Bit

The identifier for the bit ODBC SQL data type is:

SQL_BIT

The following table shows the ODBC C data types to which bit SQL data may be converted. For an explanation of the columns and terms in the table, see Converting Data from SQL to C Data Types.

C type identifier Test *TargetValuePtr *StrLen_or_IndPtr SQLSTATE
SQL_C_CHAR

SQL_C_WCHAR
BufferLength > 1

BufferLength <= 1
Data

Undefined
1

Undefined
n/a

22003
SQL_C_STINYINT

SQL_C_UTINYINT

SQL_C_TINYINT

SQL_C_SBIGINT

SQL_C_UBIGINT

SQL_C_SSHORT

SQL_C_USHORT

SQL_C_SHORT

SQL_C_SLONG

SQL_C_ULONG

SQL_C_LONG

SQL_C_FLOAT

SQL_C_DOUBLE

SQL_C_NUMERIC
None[a] Data Size of the C data type n/a
SQL_C_BIT None[a] Data 1[b] n/a
SQL_C_BINARY BufferLength >= 1

BufferLength < 1
Data

Undefined
1

Undefined
n/a

22003

[a] The value of BufferLength is ignored for this conversion. The driver assumes that the size of *TargetValuePtr is the size of the C data type.

[b] This is the size of the corresponding C data type.

When bit SQL data is converted to character C data, the possible values are "0" and "1".