当前位置: 首页>>代码示例>>PHP>>正文


PHP SQLite3::open方法代码示例

本文整理汇总了PHP中SQLite3::open方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLite3::open方法的具体用法?PHP SQLite3::open怎么用?PHP SQLite3::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLite3的用法示例。


在下文中一共展示了SQLite3::open方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connect

 /**
  * Establishes a connection to the defined database.
  *
  * @return void
  */
 public function connect()
 {
     if ($this->connected === TRUE) {
         return;
     }
     if ($this->configuration['db']['driver'] != 'sqlite3') {
         $this->logger->error('Cannot connect to a non-sqlite3 database connection!');
         return;
     }
     $flag = $this->readonly ? SQLITE3_OPEN_READONLY : SQLITE3_OPEN_READWRITE;
     $this->sqlite3->open($this->db, $flag | SQLITE3_OPEN_CREATE, '');
     if ($this->sqlite3->lastErrorCode() === 0) {
         $this->connected = TRUE;
     }
 }
开发者ID:rubendgr,项目名称:lunr,代码行数:20,代码来源:SQLite3Connection.php

示例2: open

 /**
  * @param $db_filename = string fullpath to db-file
  * @param $access_mode = integer [ 0 = readonly | 1 = writeable | 2 = createIfNotExist ] default in parent is 3 (writeable + createIfNotExist)
  **/
 public function open($db_filename, $access_mode = 0, $encryptionKey = '')
 {
     $create = false;
     switch ($access_mode) {
         case 3:
         case 2:
             $mode = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE;
             $create = true;
             break;
         case 1:
             $mode = SQLITE3_OPEN_READWRITE;
             break;
         default:
             $mode = SQLITE3_OPEN_READONLY;
             break;
     }
     // first check for file
     if (!$create && !file_exists($db_filename) || !$create && $mode == 0 && !is_readable($db_filename) || !$create && $mode == 1 && (!is_writable($db_filename) || !is_readable($db_filename))) {
         return false;
     }
     // open file
     $this->fn = $db_filename;
     parent::open($db_filename, $mode, $encryptionKey);
     // check if file is a valid db
     $check = @parent::querySingle('SELECT count(*) FROM sqlite_master');
     $code = @parent::lastErrorCode();
     if (0 < $check || 0 == $check && 0 == $code) {
         return true;
     } else {
         $this->errormsg = parent::lastErrorMsg();
         return false;
     }
 }
开发者ID:horst-n,项目名称:WireQueue,代码行数:37,代码来源:WireQueueLibHnSqlite3.php

示例3: db_connect

 /**
  * Non-persistent database connection
  *
  * @access	private called by the base class
  * @return	resource
  */
 function db_connect()
 {
     //if ( ! $conn_id = @sqlite_open(, FILE_WRITE_MODE, $error))
     if (!($conn_id = @SQLite3::open($this->database, $error))) {
         log_message('error', $error);
         if ($this->db_debug) {
             $this->display_error($error, '', TRUE);
         }
         return FALSE;
     }
     return $conn;
 }
开发者ID:laiello,项目名称:backman,代码行数:18,代码来源:sqlite_driver.php

示例4: catch

<?php

try {
    $db = new SQLite3(__DIR__ . '/db1.db');
    $db->open(__DIR__ . '/db1.db');
} catch (Exception $ex) {
    var_dump($ex->getMessage());
}
@unlink(__DIR__ . '/db1.db');
开发者ID:alphaxxl,项目名称:hhvm,代码行数:9,代码来源:sqlite3_31_open.php

示例5: __construct

public  function __construct($filename='http_sessions.db'){
        $this->savePath = ini_get('session.save_path'). DIRECTORY_SEPARATOR .$filename;
        $this->dbHandle = parent::open($this->savePath);}
开发者ID:VPtvfy,项目名称:php_sqlite_session,代码行数:3,代码来源:sqlite.inc.php


注:本文中的SQLite3::open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。