Пример #1
0
    return (int) $a + strlen($c);
}
function sumlen_fini($a)
{
    return (int) $a;
}
$db = new SQLite3(':memory:test');
$db->exec("DROP TABLE IF EXISTS foo");
$db->exec("CREATE TABLE foo (bar STRING)");
$db->exec("INSERT INTO foo VALUES ('ABC')");
$db->exec("INSERT INTO foo VALUES ('DEF')");
VS($db->lastinsertrowid(), 2);
VS($db->changes(), 1);
VS($db->lasterrorcode(), 0);
VS($db->lasterrormsg(), "not an error");
VS($db->escapestring("'\""), "''\"");
VS($db->querysingle("SELECT * FROM foo"), "ABC");
VS($db->querysingle("SELECT * FROM foo", true), array("bar" => "ABC"));
$res = $db->query("SELECT * FROM foo");
VS($res->fetcharray(), array(0 => "ABC", "bar" => "ABC"));
VS($res->numcolumns(), 1);
VS($res->columnname(0), "bar");
VS($res->columntype(0), SQLITE3_TEXT);
VS($res->fetcharray(SQLITE3_NUM), array("DEF"));
$stmt = $db->prepare("SELECT * FROM foo WHERE bar = :id");
VS($stmt->paramcount(), 1);
$id = "DEF";
VERIFY($stmt->bindvalue(":id", $id, SQLITE3_TEXT));
$id = "ABC";
$res = $stmt->execute();
VS($res->fetcharray(SQLITE3_NUM), array("DEF"));