Skip to content

Commit e6f8aa8

Browse files
committed
Treat SQL_BIT like SQL_BOOLEAN
It seems LUW prefers SQL_BIT (-7), but i prefers SQ_BOOLEAN (16). The IBM i header files explicitly mark bit (and tinyint) as not supported, but LUW supports them in the extended datatypes header.
1 parent 90c4950 commit e6f8aa8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ibm_db2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,7 @@ static int _php_db2_bind_column_helper(stmt_handle *stmt_res)
21232123
break;
21242124

21252125
case SQL_BOOLEAN:
2126+
case SQL_BIT:
21262127
rc = SQLBindCol((SQLHSTMT)stmt_res->hstmt, (SQLUSMALLINT)(i + 1),
21272128
SQL_C_LONG, &row_data->i_val, sizeof(row_data->i_val),
21282129
(SQLINTEGER *)(&stmt_res->row_data[i].out_length));
@@ -4454,6 +4455,7 @@ static int _php_db2_bind_data( stmt_handle *stmt_res, param_node *curr, zval **b
44544455

44554456
switch ( curr->data_type ) {
44564457
case SQL_BOOLEAN:
4458+
case SQL_BIT:
44574459
case SQL_SMALLINT:
44584460
case SQL_INTEGER:
44594461
case SQL_REAL:
@@ -5492,6 +5494,7 @@ PHP_FUNCTION(db2_field_type)
54925494
}
54935495
switch (stmt_res->column_info[col].type) {
54945496
case SQL_BOOLEAN:
5497+
case SQL_BIT:
54955498
str_val = "boolean";
54965499
break;
54975500
case SQL_SMALLINT:
@@ -5946,6 +5949,7 @@ PHP_FUNCTION(db2_result)
59465949

59475950
/* BOOLEAN can't be represented as true/false because false is considered an error */
59485951
case SQL_BOOLEAN:
5952+
case SQL_BIT:
59495953
case SQL_SMALLINT:
59505954
case SQL_INTEGER:
59515955
rc = _php_db2_get_data(stmt_res, col_num+1, SQL_C_LONG, (SQLPOINTER)&long_val, sizeof(long_val), &out_length);
@@ -6306,6 +6310,7 @@ static void _php_db2_bind_fetch_helper(INTERNAL_FUNCTION_PARAMETERS, int op)
63066310
}
63076311
break;
63086312
case SQL_BOOLEAN:
6313+
case SQL_BIT:
63096314
if ( op & DB2_FETCH_ASSOC ) {
63106315
add_assoc_bool(return_value, (char *)stmt_res->column_info[i].name, row_data->i_val);
63116316
}

0 commit comments

Comments
 (0)