Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: SQLite3_stmt::clear prepared statement results
                      3: --SKIPIF--
                      4: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: require_once(dirname(__FILE__) . '/new_db.inc');
                      9: define('TIMENOW', time());
                     10: 
                     11: echo "Creating Table\n";
                     12: var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
                     13: 
                     14: echo "INSERT into table\n";
                     15: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
                     16: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
                     17: 
                     18: echo "SELECTING results\n";
                     19: $stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");
                     20: $foo = 'c';
                     21: echo "BINDING Parameter\n";
                     22: var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT));
                     23: $foo = 'a';
                     24: $results = $stmt->execute();
                     25: while ($result = $results->fetchArray(SQLITE3_NUM)) {
                     26:        var_dump($result);
                     27: }
                     28: $stmt->reset();
                     29: $stmt->clear();
                     30: var_dump($stmt->bindValue(1, 'b', SQLITE3_TEXT));
                     31: $results = $stmt->execute();
                     32: while ($result = $results->fetchArray(SQLITE3_NUM)) {
                     33:        var_dump($result);
                     34: }
                     35: $results->finalize();
                     36: 
                     37: echo "Closing database\n";
                     38: var_dump($db->close());
                     39: echo "Done\n";
                     40: ?>
                     41: --EXPECTF--
                     42: Creating Table
                     43: bool(true)
                     44: INSERT into table
                     45: bool(true)
                     46: bool(true)
                     47: SELECTING results
                     48: BINDING Parameter
                     49: bool(true)
                     50: array(2) {
                     51:   [0]=>
                     52:   int(%d)
                     53:   [1]=>
                     54:   string(1) "a"
                     55: }
                     56: bool(true)
                     57: array(2) {
                     58:   [0]=>
                     59:   int(%d)
                     60:   [1]=>
                     61:   string(1) "b"
                     62: }
                     63: Closing database
                     64: bool(true)
                     65: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>