mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-10-26 03:09:02 +08:00
[odbc] Format boolean values correctly as SQL_C_CHAR (#327)
When a boolean column value is requested as a SQL_C_CHAR value, correctly return a "1" or "0" string value
This commit is contained in:
@@ -1465,9 +1465,19 @@ SQLRETURN SQL_API SQLGetData(
|
|||||||
|
|
||||||
if (col->col_type == MDB_BOOL) {
|
if (col->col_type == MDB_BOOL) {
|
||||||
// bool cannot be null
|
// bool cannot be null
|
||||||
|
if (fCType == SQL_C_CHAR) {
|
||||||
|
if ( col->cur_value_len )
|
||||||
|
((char *)rgbValue)[0] = '0';
|
||||||
|
else
|
||||||
|
((char *)rgbValue)[0] = '1';
|
||||||
|
((char *)rgbValue)[1] = '\0';
|
||||||
|
if (pcbValue)
|
||||||
|
*pcbValue = sizeof(SQLCHAR);
|
||||||
|
} else {
|
||||||
*(BOOL*)rgbValue = col->cur_value_len ? 0 : 1;
|
*(BOOL*)rgbValue = col->cur_value_len ? 0 : 1;
|
||||||
if (pcbValue)
|
if (pcbValue)
|
||||||
*pcbValue = 1;
|
*pcbValue = 1;
|
||||||
|
}
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
if (col->cur_value_len == 0) {
|
if (col->cur_value_len == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user