Reintroduce param NULL testing (see bug #26777)

This commit is contained in:
Ard Biesheuvel 2004-02-15 18:34:47 +00:00
parent 47c49ee013
commit 595d6a2d84
2 changed files with 13 additions and 6 deletions

View File

@ -754,7 +754,7 @@ PHP_MINFO_FUNCTION(ibase)
#ifdef __GNUC__
void (*info_func)(char*) = dlsym(RTLD_DEFAULT, "isc_get_client_version");
#else
void (__stdcall *info_func)(char*) = NULL;
void (__stdcall *info_func)(char*);
HMODULE l = GetModuleHandle("fbclient");
@ -1615,8 +1615,8 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size,
}
/* }}} */
static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf,
ibase_query *ib_query TSRMLS_DC) /* {{{ */
static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, /* {{{ */
ibase_query *ib_query TSRMLS_DC)
{
int i, rv = SUCCESS;
XSQLVAR *var = sqlda->sqlvar;
@ -1628,6 +1628,10 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf,
var->sqlind = &buf[i].sqlind;
if (Z_TYPE_P(b_var) == IS_NULL) {
if ((var->sqltype & 1) != 1) {
_php_ibase_module_error("Parameter %d must have a value" TSRMLS_CC, i+1);
rv = FAILURE;
}
buf[i].sqlind = -1;
} else {
buf[i].sqlind = 0;

View File

@ -12,7 +12,7 @@ InterBase: misc sql types (may take a while)
ibase_query(
"create table test3 (
iter integer,
iter integer not null,
v_char char(1000),
v_date timestamp,
v_decimal4_2 decimal(4,2),
@ -29,6 +29,9 @@ InterBase: misc sql types (may take a while)
)");
ibase_commit();
/* should fail, but gracefully */
@ibase_query("insert into test3 (iter) values (?)", null);
/* if timefmt is not supported, suppress error here */
@ibase_timefmt("%m/%d/%Y %H:%M:%S");
@ -41,7 +44,7 @@ InterBase: misc sql types (may take a while)
$v_decimal7_2 = rand_number(7,2);
$v_decimal7_0 = rand_number(7,0);
$v_numeric15_15 = rand_number(15,15);
$v_numeric15_0 = rand_number(15,0);
$v_numeric15_0 = $iter ? rand_number(15,0) : 0;
$v_double = rand_number(18);
$v_float = rand_number(7);
$v_integer = rand_number(9,0);
@ -88,7 +91,7 @@ InterBase: misc sql types (may take a while)
echo " in: $v_numeric15_15\n";
echo " out: $row->V_NUMERIC15_15\n";
}
if($row->V_NUMERIC15_0 != $v_numeric15_0){
if($row->V_NUMERIC15_0 != (string)$v_numeric15_0){
echo " NUMERIC15_0 fail\n";
echo " in: $v_numeric15_0\n";
echo " out: $row->V_NUMERIC15_0\n";