2 sqlite-oo: factory and exception
7 if (!extension_loaded("sqlite")) print "skip"; ?>
10 $dbname = tempnam(dirname(__FILE__), "phpsql");
17 register_shutdown_function("cleanup");
20 $db = sqlite_factory();
21 } catch(SQLiteException $err) {
22 echo "Message: ".$err->getMessage()."\n";
23 echo "File: ".$err->getFile()."\n";
24 //echo "Line: ".$err->getLine()."\n";
25 //print_r($err->getTrace());
26 //echo "BackTrace: ".$err->getTraceAsString()."\n";
29 $db = sqlite_factory($dbname);
32 array (0 => 'one', 1 => 'two'),
33 array (0 => 'three', 1 => 'four')
36 $db->query("CREATE TABLE strings(a VARCHAR, b VARCHAR)");
38 foreach ($data as $str) {
39 $db->query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')");
42 $r = $db->unbufferedQuery("SELECT a, b from strings");
44 var_dump($r->current(SQLITE_NUM));
52 Message: sqlite_factory() expects at least 1 parameter, 0 given
53 File: %ssqlite_oo_020.php