4 psi.directory={PWD}:{PWD}/../../psi.d
7 extension_loaded("psi") or printf("%s\n", "skip - need ext/psi");
8 function_exists("sqlite3\\open") or printf("%s\n", "skip - need libsqlite3");
14 var_dump(sqlite3\version());
16 copy(__DIR__."/sqlite001.db", __DIR__."/sqlite001.tmp");
18 $rc = sqlite3\open(__DIR__."/sqlite001.tmp", $db);
20 printf("%s\n", sqlite3\errstr($rc));
23 function callback($context, int $argc, array $argv, array $cols) {
24 $context->row = $context->row ?? 0;
26 for ($i = 0; $i < $argc; ++$i) {
27 printf("%d: %s = %s\n", $context->row, $cols[$i], $argv[$i] ?? "<NULL>");
33 $rc = sqlite3\exec($db, "SELECT * FROM test", "callback", new stdClass, $error);
35 printf("%s: '%s'\n", sqlite3\errstr($rc), $error);
38 $rc = sqlite3\exec($db, "INSERT INTO test VALUES (3,'three')", "callback", new stdClass, $error);
40 printf("%s: '%s'\n", sqlite3\errstr($rc), $error);
43 $rc = sqlite3\exec($db, "SELECT * FROM test", "callback", new stdClass, $error);
45 printf("%s: '%s'\n", sqlite3\errstr($rc), $error);
48 $rc = sqlite3\exec($db, "SELECT *", "callback", new stdClass, $error);
50 printf("%s: '%s'\n", sqlite3\errstr($rc), $error);
55 $rc = sqlite3\exec($db, "SELECT *", "callback", new stdClass, $error);
57 printf("%s: '%s'\n", sqlite3\errstr($rc), $error);
80 SQL logic error or missing database: 'no tables specified'
84 @unlink(__DIR__."/sqlite001.tmp");