1--TEST-- 2SQLite3Stmt::paramCount basic test 3--SKIPIF-- 4<?php require_once(__DIR__ . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8require_once(__DIR__ . '/new_db.inc'); 9 10echo "Creating Table\n"; 11var_dump($db->exec('CREATE TABLE foobar (id INTEGER, name STRING, city STRING)')); 12 13echo "INSERT into table\n"; 14var_dump($db->exec("INSERT INTO foobar (id, name, city) VALUES (1, 'john', 'LA')")); 15var_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 25echo "SELECTING results\n"; 26 27foreach($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 36echo "Closing database\n"; 37$stmt = null; 38$result = null; 39var_dump($db->close()); 40echo "Done\n"; 41?> 42--EXPECTF-- 43Creating Table 44bool(true) 45INSERT into table 46bool(true) 47bool(true) 48SELECTING results 49Param count for query 1: 50int(1) 51Param count for query 2: 52int(0) 53Param count for query 3: 54int(2) 55Param count for query 4: 56int(1) 57Closing database 58bool(true) 59Done 60