Exemplo n.º 1
0
 function SQLite($db_path)
 {
     $this->db = @sqlite_open($db_path, 0666, $this->sqlite_error);
     if (!$this->isError()) {
         sqlite_busy_timeout($this->db, 30000);
         // 30 seconds before SQLITE_BUSY
     }
 }
Exemplo n.º 2
0
 /**
  * コンストラクタ。
  */
 protected function __construct()
 {
     $file = WIKIID . '.db';
     $this->link = sqlite_open(DATA_DIR . $file, 0666, $error);
     if ($this->link == false) {
         clearstatcache();
         if (is_writable(DATA_DIR) == false) {
             throw new FatalException('DATA_DIRへの書き込み権限がありません。', $error);
         } else {
             if (is_writable(DATA_DIR . $file) == false) {
                 throw new FatalException('DBファイルへの書き込み権限がありません。', $error);
             } else {
                 throw new FatalException('DBファイルを開けませんでした。', $error);
             }
         }
     }
     sqlite_busy_timeout($this->link, 5000);
 }
Exemplo n.º 3
0
 function SelectDb($data = "")
 {
     $database = $data ? $data : $this->data;
     if (!$database) {
         return false;
     }
     $this->data = $database;
     if (!file_exists($this->data)) {
         die("NO DATA FILE");
     }
     $starttime = $this->TimeUsed();
     $func = $this->dbconn ? "sqlite_popen" : "sqlite_open";
     $this->conn = $func($this->data, 0666, $error) or die($error);
     sqlite_busy_timeout($this->conn, 10);
     #[限制超过30毫秒超解锁]
     #[设置使用UTF8编辑]
     sqlite_query($this->conn, "PRAGMA encoding = 'UTF-8'");
     $endtime = $this->TimeUsed();
     $this->connTimes += round($endtime - $starttime, 5);
     #[连接数据库的时间]
 }
Exemplo n.º 4
0
function sqlitem_busy_timeout($dhb, $milliseconds = 0)
{
    return sqlite_busy_timeout($dhb, $milliseconds);
}
 function sqlitem_busy_timeout($milliseconds = 0)
 {
     if (DEBUG) {
         $out = sqlite_busy_timeout($this->connId, $milliseconds);
     } else {
         $out = @sqlite_busy_timeout($this->connId, $milliseconds);
     }
     return $out;
 }
Exemplo n.º 6
0
 /**
  * Set the waiting time to busy
  *
  * @param    int		$milliseconds	number of missiseconds
  * @access	public
  * @return	void
  */
 function setWaitingTime($milliseconds)
 {
     $this->_busyTimeout = $milliseconds;
     sqlite_busy_timeout($this->conn, $this->_busyTimeout);
 }
Exemplo n.º 7
0
 function select_db($data = "")
 {
     $database = $data ? $data : $this->data;
     if (!file_exists($database)) {
         exit("Error: " . $database . " not found.");
     }
     $start_time = $this->time_used();
     $this->conn = sqlite_open($database, 0666, $error) or die($error);
     if (!$this->conn) {
         return false;
     }
     sqlite_busy_timeout($this->conn, 30);
     #[限制超过30毫秒超解锁]
     $this->work_begin();
     $this->query("PRAGMA encoding = 'UTF-8'");
     #[设置使用UTF8编辑]
     $end_time = $this->time_used();
     $this->conn_times += round($end_time - $start_time, 5);
     #[连接数据库的时间]
     return true;
 }