本文整理汇总了PHP中sqlite_close函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_close函数的具体用法?PHP sqlite_close怎么用?PHP sqlite_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
/**
* @file
* Test sqlite availability.
*/
function error($message)
{
global $db;
sqlite_close($db);
unlink('test.db');
die($message);
}
示例2: close
function close()
{
if ($this->sqlite) {
sqlite_close($this->sqlite);
$this->sqlite = null;
}
}
示例3: CreateDatabase
function CreateDatabase(&$db, $name)
{
if (!function_exists("sqlite_open")) {
return $db->SetError("Connect", "SQLite support is not available in this PHP configuration");
}
$database_file = $db->GetDatabaseFile($name);
if (@file_exists($database_file)) {
return $db->SetError("Create database", "database already exists");
}
@touch($database_file);
if (!@file_exists($database_file)) {
return $db->SetError("Create database", "Unable to create new database. Permission denied");
}
$mode = isset($db->options["AccessMode"]) ? strcmp($db->options["AccessMode"][0], "0") ? intval($db->options["AccessMode"]) : octdec($db->options["AccessMode"]) : 0640;
@chmod($database_file, $mode);
if (!is_readable($database_file)) {
@unlink($database_file);
return $db->SetError("Create database", "Unable to open database for Reading. Permission denied");
}
if (!is_writable($database_file)) {
@unlink($database_file);
return $db->SetError("Create database", "Unable to open database for Writing. Permission denied");
}
$handle = @sqlite_open($database_file, $mode);
if (!$handle) {
@unlink($database_file);
return $db->SetError("Create database", isset($php_errormsg) ? $php_errormsg : "could not create the database file");
}
sqlite_close($handle);
return 1;
}
示例4: sql_close
function sql_close()
{
if (!$this->db_connect_id) {
return false;
}
return @sqlite_close($this->db_connect_id);
}
示例5: disconnect
function disconnect()
{
//DBとの接続を切断する。
$flag = 1;
sqlite_close($this->link) or $flag = false;
return $flag;
}
示例6: disconnect
/**
* @return SQLite
**/
public function disconnect()
{
if ($this->isConnected()) {
sqlite_close($this->link);
}
return $this;
}
示例7: init
/**
* Initializes and opens the database
*
* Needs to be called right after loading this helper plugin
*/
function init($dbname, $updatedir)
{
global $conf;
// check for already open DB
if ($this->db) {
if ($this->dbname == $dbname) {
// db already open
return true;
}
// close other db
sqlite_close($this->db);
$this->db = null;
$this->dbname = '';
}
$this->dbname = $dbname;
$dbfile = $conf['metadir'] . '/' . $dbname . '.sqlite';
$init = !@file_exists($dbfile) || (int) @filesize($dbfile) < 3;
$error = '';
$this->db = sqlite_open($dbfile, 0666, $error);
if (!$this->db) {
msg("SQLite: failed to open SQLite " . $this->dbname . " database ({$error})", -1);
return false;
}
// register our custom aggregate function
sqlite_create_aggregate($this->db, 'group_concat', array($this, '_sqlite_group_concat_step'), array($this, '_sqlite_group_concat_finalize'), 2);
$this->_updatedb($init, $updatedir);
return true;
}
示例8: close
function close()
{
if (!is_null($this->db)) {
sqlite_close($this->db);
}
$this->db = null;
}
示例9: prepareDB
public function prepareDB($bWithData = true)
{
if (file_exists(dirname(__FILE__) . '/unittest.db')) {
unlink(dirname(__FILE__) . '/unittest.db');
}
$db = sqlite_open(dirname(__FILE__) . '/unittest.db');
$res = sqlite_query($db, 'CREATE TABLE people (id INTEGER PRIMARY KEY, firstName TEXT, lastName TEXT)', $sError);
if ($res === false) {
throw new Exception($sError);
}
if ($bWithData) {
$res = sqlite_query($db, 'INSERT INTO people (id,firstName,lastName) VALUES (1, \'Jerome\', \'Piochet\')', $sError);
if ($res === false) {
throw new Exception($sError);
}
$res = sqlite_query($db, 'INSERT INTO people (id,firstName,lastName) VALUES (2, \'Tadao\', \'Poichet\')', $sError);
if ($res === false) {
throw new Exception($sError);
}
$res = sqlite_query($db, 'INSERT INTO people (id,firstName,lastName) VALUES (3, \'A\', \'B\')', $sError);
if ($res === false) {
throw new Exception($sError);
}
$res = sqlite_query($db, 'INSERT INTO people (id,firstName,lastName) VALUES (4, \'C\', \'D\')', $sError);
if ($res === false) {
throw new Exception($sError);
}
}
sqlite_close($db);
}
示例10: disconnect
function disconnect()
{
if (is_resource($this->connectionId)) {
sqlite_close($this->connectionId);
$this->connectionId = null;
}
}
示例11: dbclose
public function dbclose()
{
if ($this->db != -1) {
sqlite_close($this->db);
$db = -1;
}
}
示例12: Disconnect
private function Disconnect()
{
if (!is_null($this->link)) {
return sqlite_close($this->link);
}
return false;
}
示例13: close
function close()
{
if ($this->handler) {
return sqlite_close($this->handler);
} else {
die('データベースハンドラが見つかりません。');
}
}
示例14: close
public static function close()
{
// garbage collect once in a hundred page requests
if (rand(1, 100) == 100) {
Session::cleanup();
}
return @sqlite_close(SESSION_DB_LINK);
}
示例15: Close
public function Close()
{
if ($this->connection === false) {
throw new DatabaseEx('Not connected to a database server!');
}
sqlite_close($this->connection);
$this->connection = null;
}