]> granicus.if.org Git - php/commitdiff
Reintroduce param NULL testing (see bug #26777)
authorArd Biesheuvel <abies@php.net>
Sun, 15 Feb 2004 18:34:47 +0000 (18:34 +0000)
committerArd Biesheuvel <abies@php.net>
Sun, 15 Feb 2004 18:34:47 +0000 (18:34 +0000)
ext/interbase/interbase.c
ext/interbase/tests/003.phpt

index 77ba2792f3706a18e2d21624d4f40a749bff7e81..daf5bc444417923e85f462a6102b852371542c6a 100644 (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;
index 2d105b18665072f7fd0ff16a6e7802b3b86f3afe..d3e60461e56bf9df2fae7aa78832fcf3d6799911 100644 (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";