本文整理汇总了PHP中SQLite3::createfunction方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLite3::createfunction方法的具体用法?PHP SQLite3::createfunction怎么用?PHP SQLite3::createfunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite3
的用法示例。
在下文中一共展示了SQLite3::createfunction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
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"));
VERIFY($stmt->clear());
VERIFY($stmt->reset());
$id = "DEF";
VERIFY($stmt->bindparam(":id", $id, SQLITE3_TEXT));
$id = "ABC";
$res = $stmt->execute();
VS($res->fetcharray(SQLITE3_NUM), array("ABC"));
VERIFY($db->createfunction("tolower", "lower", 1));
$res = $db->query("SELECT tolower(bar) FROM foo");
VS($res->fetcharray(SQLITE3_NUM), array("abc"));
VERIFY($db->createaggregate("sumlen", "sumlen_step", "sumlen_fini", 1));
$res = $db->query("SELECT sumlen(bar) FROM foo");
VS($res->fetcharray(SQLITE3_NUM), array(6));
// Since minor version can change frequently, just test the major version
VS($db->version()['versionString'][0], "3");
VERIFY((int) $db->version()['versionNumber'] > (int) 3000000);
$db->close();
unlink(":memory:test");
// Check that a PHP Exception is thrown for nonexistant databases
try {
new SQLite3('/' . uniqid('random', true) . '/db');
} catch (Exception $e) {
var_dump(true);