當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sqlite_popen函數代碼示例

本文整理匯總了PHP中sqlite_popen函數的典型用法代碼示例。如果您正苦於以下問題:PHP sqlite_popen函數的具體用法?PHP sqlite_popen怎麽用?PHP sqlite_popen使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了sqlite_popen函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: db_connect

 /**
  * Non-persistent database connection.
  *
  * @param bool $persistent
  *
  * @return resource
  */
 public function db_connect($persistent = false)
 {
     $error = null;
     $conn_id = $persistent === true ? sqlite_popen($this->database, 0666, $error) : sqlite_open($this->database, 0666, $error);
     isset($error) && log_message('error', $error);
     return $conn_id;
 }
開發者ID:recca0120,項目名稱:laraigniter,代碼行數:14,代碼來源:sqlite_driver.php

示例2: sql_connect

 /**
  * {@inheritDoc}
  */
 function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
 {
     $this->persistency = $persistency;
     $this->user = $sqluser;
     $this->server = $sqlserver . ($port ? ':' . $port : '');
     $this->dbname = $database;
     $error = '';
     if ($this->persistency) {
         if (!function_exists('sqlite_popen')) {
             $this->connect_error = 'sqlite_popen function does not exist, is sqlite extension installed?';
             return $this->sql_error('');
         }
         $this->db_connect_id = @sqlite_popen($this->server, 0666, $error);
     } else {
         if (!function_exists('sqlite_open')) {
             $this->connect_error = 'sqlite_open function does not exist, is sqlite extension installed?';
             return $this->sql_error('');
         }
         $this->db_connect_id = @sqlite_open($this->server, 0666, $error);
     }
     if ($this->db_connect_id) {
         @sqlite_query('PRAGMA short_column_names = 1', $this->db_connect_id);
         //			@sqlite_query('PRAGMA encoding = "UTF-8"', $this->db_connect_id);
     }
     return $this->db_connect_id ? true : array('message' => $error);
 }
開發者ID:Tarendai,項目名稱:spring-website,代碼行數:29,代碼來源:sqlite.php

示例3: sql_db

 function sql_db($sqlserver, $trash, $trash, $trash, $persistency = true)
 {
     $this->persistency = $persistency;
     $this->server = $sqlserver;
     $this->db_connect_id = $this->persistency ? @sqlite_popen($this->server, 0666, $sqliteerror) : @sqlite_open($this->server, 0666, $sqliteerror);
     return $this->db_connect_id ? $this->db_connect_id : false;
 }
開發者ID:rotvulpix,項目名稱:php-nuke,代碼行數:7,代碼來源:sqlite.php

示例4: dblayer

 function dblayer($db_host, $db_user, $db_pass, $db_name, $p_connect = false)
 {
     // Support SQLite
     if (!function_exists('sqlite_open')) {
         exit('This PHP environment doesn\'t have SQLite support built in. SQLite support is required if you want to use a SQLite database to run this forum. Consult the PHP documentation for further assistance.');
     }
     // Prepend $db_name with the path to the forum root directory
     $db_name = EPS_ROOT . $db_name;
     if (!file_exists($db_name)) {
         @touch($db_name);
         @chmod($db_name, 0666);
         if (!file_exists($db_name)) {
             error('Unable to create new database \'' . $db_name . '\'. Permission denied', __FILE__, __LINE__);
         }
     }
     if (!is_readable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for reading. Permission denied', __FILE__, __LINE__);
     }
     if (!is_writable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for writing. Permission denied', __FILE__, __LINE__);
     }
     if ($p_connect) {
         $this->link_id = @sqlite_popen($db_name, 0666, $sqlite_error);
     } else {
         $this->link_id = @sqlite_open($db_name, 0666, $sqlite_error);
     }
     if (!$this->link_id) {
         error('Unable to open database \'' . $db_name . '\'. SQLite reported: ' . $sqlite_error, __FILE__, __LINE__);
     } else {
         return $this->link_id;
     }
 }
開發者ID:nqv,項目名稱:eposys,代碼行數:32,代碼來源:class_sqlite.php

示例5: connect

 /**
  * Connects to a database.
  * @return void
  * @throws DibiException
  */
 public function connect(array &$config)
 {
     DibiConnection::alias($config, 'database', 'file');
     $this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U';
     $this->fmtDateTime = isset($config['formatDateTime']) ? $config['formatDateTime'] : 'U';
     $errorMsg = '';
     if (isset($config['resource'])) {
         $this->connection = $config['resource'];
     } elseif (empty($config['persistent'])) {
         $this->connection = @sqlite_open($config['database'], 0666, $errorMsg);
         // intentionally @
     } else {
         $this->connection = @sqlite_popen($config['database'], 0666, $errorMsg);
         // intentionally @
     }
     if (!$this->connection) {
         throw new DibiDriverException($errorMsg);
     }
     $this->buffered = empty($config['unbuffered']);
     $this->dbcharset = empty($config['dbcharset']) ? 'UTF-8' : $config['dbcharset'];
     $this->charset = empty($config['charset']) ? 'UTF-8' : $config['charset'];
     if (strcasecmp($this->dbcharset, $this->charset) === 0) {
         $this->dbcharset = $this->charset = NULL;
     }
 }
開發者ID:Scrik,項目名稱:Need-For-Speed-World-Statistics-Website,代碼行數:30,代碼來源:sqlite.php

示例6: __construct

 function __construct($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
 {
     // Prepend $db_name with the path to the forum root directory
     $db_name = LUNA_ROOT . $db_name;
     $this->prefix = $db_prefix;
     if (!file_exists($db_name)) {
         @touch($db_name);
         @chmod($db_name, 0666);
         if (!file_exists($db_name)) {
             error('Unable to create new database \'' . $db_name . '\'. Permission denied', __FILE__, __LINE__);
         }
     }
     if (!is_readable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for reading. Permission denied', __FILE__, __LINE__);
     }
     if (!forum_is_writable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for writing. Permission denied', __FILE__, __LINE__);
     }
     if ($p_connect) {
         $this->link_id = @sqlite_popen($db_name, 0666, $sqlite_error);
     } else {
         $this->link_id = @sqlite_open($db_name, 0666, $sqlite_error);
     }
     if (!$this->link_id) {
         error('Unable to open database \'' . $db_name . '\'. SQLite reported: ' . $sqlite_error, __FILE__, __LINE__);
     } else {
         return $this->link_id;
     }
 }
開發者ID:BlitzFirePlayz,項目名稱:Luna,代碼行數:29,代碼來源:sqlite.php

示例7: connect

 public function connect()
 {
     if ($this->_connection) {
         return;
     }
     // Extract the connection parameters, adding required variabels
     extract($this->_config['connection'] + array('database' => '', 'persistent' => FALSE));
     try {
         if ($persistent) {
             // Create a persistent connection
             $this->_connection = sqlite_popen($database);
         } else {
             // Create a connection and force it to be a new link
             $this->_connection = sqlite_open($database);
         }
     } catch (Exception $e) {
         // No connection exists
         $this->_connection = NULL;
         throw new Database_Exception(':error', array(':error' => $e->getMessage()), $e->getCode());
     }
     $this->_connection_id = sha1($dsn);
     if (!empty($this->_config['connection']['variables'])) {
         // Set session variables
         $variables = array();
         foreach ($this->_config['connection']['variables'] as $var => $val) {
             $variables[] = 'SESSION ' . $var . ' = ' . $this->quote($val);
         }
         sqlite_query('SET ' . implode(', ', $variables), $this->_connection);
     }
 }
開發者ID:ametsuramet,項目名稱:belajar_kohana,代碼行數:30,代碼來源:sqlite.php

示例8: db_connect

 /**
  * Non-persistent database connection
  *
  * @param	bool	$persistent
  * @return	resource
  */
 public function db_connect($persistent = FALSE)
 {
     $error = NULL;
     $conn_id = $persistent === TRUE ? sqlite_popen($this->database, 0666, $error) : sqlite_open($this->database, 0666, $error);
     isset($error) && log_message('error', $error);
     return $conn_id;
 }
開發者ID:segaz2002,項目名稱:Codeigniter,代碼行數:13,代碼來源:sqlite_driver.php

示例9: connect

 public function connect($config = array())
 {
     $this->config = $config;
     $this->connect = $this->config['pconnect'] === true ? @sqlite_popen($this->config['database'], 0666, $error) : @sqlite_open($this->config['database'], 0666, $error);
     if (!empty($error)) {
         die(getErrorMessage('Database', 'mysqlConnectError'));
     }
 }
開發者ID:Allopa,項目名稱:ZN-Framework-Starter,代碼行數:8,代碼來源:SqliteDriver.php

示例10: vdict_open

function vdict_open($fn)
{
    global $dberror;
    if (function_exists('sqlite_popen')) {
        return sqlite_popen($fn, 0666, $dberror);
    }
    return new PDO('sqlite:' . $fn);
}
開發者ID:n2i,項目名稱:xvnkb,代碼行數:8,代碼來源:vdict.php

示例11: sql_connect

 function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port, $persistency = false)
 {
     $this->persistency = $persistency;
     $this->user = $sqluser;
     $this->server = $sqlserver . ($port ? ':' . $port : '');
     $this->dbname = $database;
     $this->db_connect_id = $this->persistency ? @sqlite_popen($this->server, 0, $error) : @sqlite_open($this->server, 0, $error);
     return $this->db_connect_id ? true : $error;
 }
開發者ID:lcorbasson,項目名稱:SemanticScuttle,代碼行數:9,代碼來源:sqlite.php

示例12: connect

 public function connect($a)
 {
     if (!empty($a['persistent'])) {
         $db1 = sqlite_popen($a['dbname']);
     } else {
         $db1 = sqlite_open($a['dbname']);
     }
     return $db1;
 }
開發者ID:robertosciarra,項目名稱:vanilla-mvc,代碼行數:9,代碼來源:sqlite.dbd.php

示例13: db_pconnect

 /**
  * Persistent database connection
  *
  * @access	private called by the base class
  * @return	resource
  */
 function db_pconnect()
 {
     if (!($conn_id = sqlite_popen($this->database, 0666, $error))) {
         log_message('error', $error);
         if ($this->db_debug) {
             $this->display_error($error, '', TRUE);
         }
     }
     return $conn_id;
 }
開發者ID:Calico90,項目名稱:codeigniter-version-scan,代碼行數:16,代碼來源:DB_sqlite.php

示例14: set_pfhost_nonwritable

function set_pfhost_nonwritable($name)
{
    global $database;
    $db = sqlite_popen($database);
    $results = sqlite_query("select * from pfhosts where name='" . sqlite_escape_string($name) . "'", $db);
    $pfhost_check = sqlite_fetch_array($results, SQLITE_ASSOC);
    if ($pfhost_check['can_connect'] == "true") {
        $results = sqlite_query("update pfhosts set can_connect='false' where name='" . sqlite_escape_string($name) . "'", $db);
    }
    sqlite_close($db);
}
開發者ID:allard-archive,項目名稱:pfw,代碼行數:11,代碼來源:pfhostsedit.php

示例15: db_pconnect

 /**
  * Persistent database connection
  *
  * @access	private called by the base class
  * @return	resource
  */
 function db_pconnect()
 {
     if (!($conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error))) {
         log_message('error', $error);
         if ($this->db_debug) {
             $this->display_error($error, '', TRUE);
         }
         return FALSE;
     }
     return $conn_id;
 }
開發者ID:mdbhk,項目名稱:retailersurvey.themdbfamily.com,代碼行數:17,代碼來源:sqlite_driver.php


注:本文中的sqlite_popen函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。