From: Dan Kalowsky Date: Tue, 26 Feb 2002 15:33:54 +0000 (+0000) Subject: Bug fix 15719 as submited by Joseph Southwell and allows NULL values in ODBC X-Git-Tag: php-4.2.0RC1~275 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a4113ee734600f0a77b6cbe0b04864c7933fdba5;p=php Bug fix 15719 as submited by Joseph Southwell and allows NULL values in ODBC # I haven't been able to fully test this due to MacOSX compliation errors. # if someone in the QA group could that'd be appriciated. --- diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 949a3e08b7..e71b80b647 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -875,6 +875,7 @@ PHP_FUNCTION(odbc_execute) } params_t; params_t *params = NULL; char *filename; + unsigned char otype; SWORD sqltype, ctype, scale; SWORD nullable; UDWORD precision; @@ -925,6 +926,8 @@ PHP_FUNCTION(odbc_execute) efree(params); RETURN_FALSE; } + + otype = (*tmp)->type; convert_to_string(*tmp); if (Z_TYPE_PP(tmp) != IS_STRING) { php_error(E_WARNING,"Error converting parameter"); @@ -984,6 +987,10 @@ PHP_FUNCTION(odbc_execute) #ifdef HAVE_DBMAKER precision = params[i-1].vallen; #endif + if (otype == IS_NULL) { + params[i-1].vallen = SQL_NULL_DATA; + } + rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT, ctype, sqltype, precision, scale, Z_STRVAL_PP(tmp), 0,