scottmac                Tue Jan 20 00:24:06 2009 UTC

  Modified files:              
    /php-src/ext/sqlite3        sqlite3.c 
  Log:
  Fix bug #47145 - As soon as sqlite3_step is called on a statement it always 
must be finalised.
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.29&r2=1.30&diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.29 php-src/ext/sqlite3/sqlite3.c:1.30
--- php-src/ext/sqlite3/sqlite3.c:1.29  Mon Jan 19 22:45:29 2009
+++ php-src/ext/sqlite3/sqlite3.c       Tue Jan 20 00:24:05 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: sqlite3.c,v 1.29 2009/01/19 22:45:29 scottmac Exp $ */
+/* $Id: sqlite3.c,v 1.30 2009/01/20 00:24:05 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1094,6 +1094,8 @@
        zval *object = getThis();
        int return_code = 0;
        struct php_sqlite3_bound_param *param;
+       php_sqlite3_free_list *free_item;
+
        stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object 
TSRMLS_CC);
 
        if (zend_parse_parameters_none() == FAILURE) {
@@ -1168,13 +1170,16 @@
        }
 
        return_code = sqlite3_step(stmt_obj->stmt);
+       free_item = emalloc(sizeof(php_sqlite3_free_list));
+       free_item->stmt_obj = stmt_obj;
+       free_item->stmt_obj_zval = getThis();
+
+       zend_llist_add_element(&(stmt_obj->db_obj->free_list), &free_item);
 
        switch (return_code) {
                case SQLITE_ROW: /* Valid Row */
                case SQLITE_DONE: /* Valid but no results */
                {
-                       php_sqlite3_free_list *free_item;
-
                        sqlite3_reset(stmt_obj->stmt);
                        object_init_ex(return_value, php_sqlite3_result_entry);
                        result = (php_sqlite3_result 
*)zend_object_store_get_object(return_value TSRMLS_CC);
@@ -1186,12 +1191,6 @@
                        result->stmt_obj = stmt_obj;
                        result->stmt_obj_zval = getThis();
 
-                       free_item = emalloc(sizeof(php_sqlite3_free_list));
-                       free_item->stmt_obj = stmt_obj;
-                       free_item->stmt_obj_zval = getThis();
-
-                       zend_llist_add_element(&(stmt_obj->db_obj->free_list), 
&free_item);
-
                        break;
                }
                case SQLITE_ERROR:



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

Reply via email to