felipe          Tue Aug 12 13:37:32 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/sqlite3/tests  bug45798.phpt 

  Modified files:              
    /php-src/ext/sqlite3        sqlite3.c 
  Log:
  - MFH: Fixed bug #45798 (sqlite3 doesn't notice if variable was bound)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.1.2.9&r2=1.1.2.10&diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.1.2.9 
php-src/ext/sqlite3/sqlite3.c:1.1.2.10
--- php-src/ext/sqlite3/sqlite3.c:1.1.2.9       Sat Aug  2 04:46:06 2008
+++ php-src/ext/sqlite3/sqlite3.c       Tue Aug 12 13:37:32 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: sqlite3.c,v 1.1.2.9 2008/08/02 04:46:06 felipe Exp $ */
+/* $Id: sqlite3.c,v 1.1.2.10 2008/08/12 13:37:32 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1069,6 +1069,7 @@
                        /* If the ZVAL is null then it should be bound as that 
*/
                        if (Z_TYPE_P(param->parameter) == IS_NULL) {
                                sqlite3_bind_null(stmt_obj->stmt, 
param->param_number);
+                               zend_hash_move_forward(stmt_obj->bound_params);
                                continue;
                        }
 

http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/bug45798.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/bug45798.phpt
+++ php-src/ext/sqlite3/tests/bug45798.phpt
--TEST--
Bug #45798 (sqlite3 doesn't notice if variable was bound)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php

require_once(dirname(__FILE__) . '/new_db.inc');

$db->exec('CREATE TABLE test (time INTEGER, id STRING)');

$db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')");
$db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'b')");

$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");

$stmt->bindParam(1, $foo, SQLITE3_TEXT);
$results = $stmt->execute();

while ($result = $results->fetchArray(SQLITE3_NUM)) {
        var_dump($result);
}

$results->finalize();

$db->close();

print "done";

?>
--EXPECT--
done



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

Reply via email to