Skip to content

Commit 314bb6c

Browse files
committed
The workaround should only affect PASE, not LUW
1 parent a0376ed commit 314bb6c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ibm_db2.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5859,6 +5859,7 @@ PHP_FUNCTION(db2_result)
58595859
if(column_type == SQL_BIGINT) {
58605860
in_length++;
58615861
}
5862+
#ifdef PASE
58625863
/*
58635864
* CB 20210128: SQL/CLI bug caused by a PTF makes SQLGetData
58645865
* return more data than what was provided from it - seems to
@@ -5886,6 +5887,14 @@ PHP_FUNCTION(db2_result)
58865887
/* yup. let's just chop it off and hope it doesn't get too worse */
58875888
((char*)out_ptr)[in_length + 1] = '\0';
58885889
}
5890+
#else
5891+
out_ptr = (SQLPOINTER)ecalloc(1, in_length);
5892+
if ( out_ptr == NULL ) {
5893+
php_error_docref(NULL, E_WARNING, "Cannot Allocate Memory");
5894+
RETURN_FALSE;
5895+
}
5896+
rc = _php_db2_get_data(stmt_res, col_num+1, SQL_C_CHAR, out_ptr, in_length, &out_length);
5897+
#endif
58895898
if ( rc == SQL_ERROR ) {
58905899
RETURN_FALSE;
58915900
}

0 commit comments

Comments
 (0)