int force_null;
case IS_LONG:
- var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) + (var->sqltype & 1);
+ /* keep the allow-NULL flag */
+ var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1);
var->sqldata = (void*)&Z_LVAL_P(param->parameter);
var->sqllen = sizeof(long);
break;
case IS_DOUBLE:
- var->sqltype = SQL_DOUBLE + (var->sqltype & 1);
+ /* keep the allow-NULL flag */
+ var->sqltype = SQL_DOUBLE | (var->sqltype & 1);
var->sqldata = (void*)&Z_DVAL_P(param->parameter);
var->sqllen = sizeof(double);
break;
force_null = (Z_STRLEN_P(param->parameter) == 0);
}
if (!force_null) {
- var->sqltype = SQL_TEXT + (var->sqltype & 1);
+ /* keep the allow-NULL flag */
+ var->sqltype = SQL_TEXT | (var->sqltype & 1);
var->sqldata = Z_STRVAL_P(param->parameter);
var->sqllen = Z_STRLEN_P(param->parameter);
break;
$sql = "insert into test_insert (id, text) values (?, ?)";
$sttmt = $dbh->prepare($sql);
-$args_ok = [1, "test1"];
-$args_err = [2, null];
+$args_ok = array(1, "test1");
+$args_err = array(2, null);
$res = $sttmt->execute($args_ok);
var_dump($res);