abies           Sun May 30 13:51:20 2004 EDT

  Modified files:              
    /php-src/ext/interbase      ibase_query.c 
  Log:
  Fix unregistered bug (segfault on uninitialised pointer)
  Return string("0 ") from ibase_query() if query succeeded but did not affect any rows
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/ibase_query.c?r1=1.8&r2=1.9&ty=u
Index: php-src/ext/interbase/ibase_query.c
diff -u php-src/ext/interbase/ibase_query.c:1.8 php-src/ext/interbase/ibase_query.c:1.9
--- php-src/ext/interbase/ibase_query.c:1.8     Fri May 21 10:24:34 2004
+++ php-src/ext/interbase/ibase_query.c Sun May 30 13:51:19 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ibase_query.c,v 1.8 2004/05/21 14:24:34 abies Exp $ */
+/* $Id: ibase_query.c,v 1.9 2004/05/30 17:51:19 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -307,6 +307,8 @@
        ib_query->dialect = dialect;
        ib_query->query = estrdup(query);
        ib_query->trans_res_id = trans_res_id;
+       ib_query->out_sqlda = NULL;
+       ib_query->in_sqlda = NULL;
 
        if (isc_dsql_allocate_statement(IB_STATUS, &link->handle, &ib_query->stmt)) {
                _php_ibase_error(TSRMLS_C);
@@ -989,10 +991,16 @@
                                        i += len+3;
                                }
                        }
-                       if (affected_rows > 0) {
-                               ib_query->trans->affected_rows = affected_rows;
-                               RETVAL_LONG(affected_rows);
-                               break;
+
+                       ib_query->trans->affected_rows = affected_rows;
+
+                       if (!ib_query->out_sqlda) { /* no result set is being returned 
*/
+                               if (affected_rows) {
+                                       RETVAL_LONG(affected_rows);
+                               } else {
+                                       /* this return value evaluates to bool(true) 
and to int(0) */
+                                       RETVAL_STRINGL("0 ",2,1);
+                               }
                        }
                        
                default:

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to