Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SQLite3Stmt::paramCount basic test
! 3: --SKIPIF--
! 4: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: require_once(dirname(__FILE__) . '/new_db.inc');
! 9:
! 10: echo "Creating Table\n";
! 11: var_dump($db->exec('CREATE TABLE foobar (id INTEGER, name STRING, city STRING)'));
! 12:
! 13: echo "INSERT into table\n";
! 14: var_dump($db->exec("INSERT INTO foobar (id, name, city) VALUES (1, 'john', 'LA')"));
! 15: var_dump($db->exec("INSERT INTO foobar (id, name, city) VALUES (2, 'doe', 'SF')"));
! 16:
! 17:
! 18: $queryArray = array(
! 19: "SELECT * FROM foobar WHERE id = ? ORDER BY id ASC",
! 20: "SELECT * FROM foobar WHERE id = 2 ORDER BY id ASC",
! 21: "SELECT * FROM foobar WHERE id = :id AND name = :name ORDER BY id ASC",
! 22: "SELECT * FROM foobar WHERE id = 1 AND name = :name ORDER BY id ASC",
! 23: );
! 24:
! 25: echo "SELECTING results\n";
! 26:
! 27: foreach($queryArray as $key => $query) {
! 28: $stmt = $db->prepare($query);
! 29:
! 30: echo 'Param count for query ' . ($key + 1) . ":\n";
! 31: var_dump($stmt->paramCount());
! 32:
! 33: $result = $stmt->execute();
! 34: }
! 35:
! 36: echo "Closing database\n";
! 37: $stmt = null;
! 38: $result = null;
! 39: var_dump($db->close());
! 40: echo "Done\n";
! 41: ?>
! 42: --EXPECTF--
! 43: Creating Table
! 44: bool(true)
! 45: INSERT into table
! 46: bool(true)
! 47: bool(true)
! 48: SELECTING results
! 49: Param count for query 1:
! 50: int(1)
! 51: Param count for query 2:
! 52: int(0)
! 53: Param count for query 3:
! 54: int(2)
! 55: Param count for query 4:
! 56: int(1)
! 57: Closing database
! 58: bool(true)
! 59: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>