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


PHP SQLite3::busyTimeout方法代码示例

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


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

示例1: connect

 public function connect($parameters, $selectDB = false)
 {
     $file = $parameters['filepath'];
     $this->dbConn = empty($parameters['key']) ? new SQLite3($file, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE) : new SQLite3($file, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, $parameters['key']);
     $this->dbConn->busyTimeout(60000);
     $this->databaseName = $parameters['database'];
 }
开发者ID:helpfulrobot,项目名称:silverstripe-sqlite3,代码行数:7,代码来源:SQLite3Connector.php

示例2: setUp

 public function setUp()
 {
     $app = (require __DIR__ . '/../../../../src/app.php');
     $this->path = sys_get_temp_dir() . '/sismo.db';
     @unlink($this->path);
     $this->db = new \SQLite3($this->path);
     $this->db->busyTimeout(1000);
     $this->db->exec($app['db.schema']);
 }
开发者ID:hyperlator,项目名称:Sismo,代码行数:9,代码来源:StorageTest.php

示例3: __construct

 /**
  * Constructor
  *
  * @param array $connectionData Connection Data passed from the CHOQ_DB handler
  */
 public function __construct(array $connectionData)
 {
     if (!self::isAvailable()) {
         error("SQLite3 and/or SQLite Extension not installed - Update your PHP configuration");
     }
     $path = $connectionData["path"];
     if (!is_dir(dirname($path)) or !is_writable(dirname($path))) {
         error("Directory path '" . dirname($path) . "' does not exist or is not writeable. Create or update directory chmod");
     }
     $this->sqlite = new SQLite3($path, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
     $this->testError();
     $this->sqlite->busyTimeout(5000);
 }
开发者ID:nonconforme,项目名称:nreeda,代码行数:18,代码来源:Sqlite3.class.php

示例4: cleanup_listeners_othermounts

function cleanup_listeners_othermounts($maxagelimitstamp_othermounts, $fingerprint, $mountpoint)
{
    $db = new SQLite3('load.db');
    $db->busyTimeout(100);
    $db->exec("DELETE FROM t_listeners WHERE timestamp < {$maxagelimitstamp_othermounts} AND fingerprint = '{$fingerprint}' AND mountpoint != '{$mountpoint}'");
    $db->close();
}
开发者ID:xxaxxelxx,项目名称:xx_loadbalancer,代码行数:7,代码来源:functions.php

示例5: db

 /**
  * @return SQLite3
  */
 protected function db()
 {
     global $mudoco_conf;
     if (!$this->_db) {
         $this->_db = new SQLite3($mudoco_conf['MUDOCO_STORAGE_NONCE_SQLITE_FILE']);
         if ($this->_db) {
             if ($this->_db->busyTimeout(2000)) {
                 $this->_db->exec('CREATE TABLE IF NOT EXISTS nonce (cnonce VARCHAR(32) PRIMARY KEY, nonce VARCHAR(32), expire INTEGER, fingerprint VARCHAR(32));');
                 $this->_db->exec('CREATE INDEX IF NOT EXISTS idx_expire ON nonce(expire);');
                 $this->_db->exec('CREATE INDEX IF NOT EXISTS idx_nonce ON nonce(nonce);');
             }
             // !important : do not release busyTimeout()
         }
     }
     return $this->_db;
 }
开发者ID:nklmthr,项目名称:mudoco,代码行数:19,代码来源:Sqlite.php

示例6: __construct

 public function __construct($filename, $flags = null, $encryptionKey = null, $busyTimeout = null, array $userDefinedFunctions = array(), array $userDefinedExtensions = array())
 {
     if (null === $flags) {
         $flags = \SQLITE3_OPEN_READWRITE | \SQLITE3_OPEN_CREATE;
     }
     $this->_conn = new SQLite3($filename, $flags, $encryptionKey);
     if (null !== $busyTimeout) {
         $this->_conn->busyTimeout($busyTimeout);
     } else {
         $this->_conn->busyTimeout(60000);
     }
     foreach ($userDefinedFunctions as $fn => $data) {
         $this->_conn->createFunction($fn, $data['callback'], $data['numArgs']);
     }
     foreach ($userDefinedExtensions as $extension) {
         $this->_conn->loadExtension($extension);
     }
 }
开发者ID:jsor,项目名称:dbal-sqlite3,代码行数:18,代码来源:Connection.php

示例7: dbconnect

function dbconnect()
{
    global $plexWatch;
    if (!class_exists('SQLite3')) {
        die("<div class=\"alert alert-warning \">php5-sqlite is not installed. Please install this requirement and restart your webserver before continuing.</div>");
    }
    $db = new SQLite3($plexWatch['plexWatchDb']);
    $db->busyTimeout(10 * 1000);
    return $db;
}
开发者ID:jlyanez,项目名称:plexWatchWeb,代码行数:10,代码来源:functions.php

示例8: dbconnect

 /**
  * This method makes sure to connect to the database properly
  *
  * @param string $strHost
  * @param string $strUsername
  * @param string $strPass
  * @param string $strDbName
  * @param int $intPort
  *
  * @throws class_exception
  * @return bool
  */
 public function dbconnect($strHost, $strUsername, $strPass, $strDbName, $intPort)
 {
     if ($strDbName == "") {
         return false;
     }
     $this->strDbFile = _projectpath_ . '/dbdumps/' . $strDbName . '.db3';
     try {
         $this->linkDB = new SQLite3(_realpath_ . $this->strDbFile);
         $this->_pQuery('PRAGMA encoding = "UTF-8"', array());
         //TODO deprecated in sqlite, so may be removed
         $this->_pQuery('PRAGMA short_column_names = ON', array());
         $this->_pQuery("PRAGMA journal_mode = TRUNCATE", array());
         if (method_exists($this->linkDB, "busyTimeout")) {
             $this->linkDB->busyTimeout(5000);
         }
         return true;
     } catch (Exception $e) {
         throw new class_exception("Error connecting to database: " . $e, class_exception::$level_FATALERROR);
     }
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:32,代码来源:class_db_sqlite3.php

示例9: __construct

 public function __construct()
 {
     global $db;
     if (!$db) {
         $db = new SQLite3('ct_database.db');
         $db->busyTimeout(5000);
     }
     //$db->exec('DROP TABLE reindex');
     //$db->exec('DROP TABLE product');
     $this->initTableProduct();
     $this->initTableReindex();
 }
开发者ID:victoray,项目名称:ChoTot-simple-crawler,代码行数:12,代码来源:database.php

示例10: __construct

 public function __construct($cid, $year, $month)
 {
     $this->cid = $cid;
     $this->datetime['month'] = $month;
     $this->datetime['year'] = $year;
     /**
      * Load settings from vars.php (contained in $settings[]).
      */
     if ((include 'vars.php') === false) {
         $this->output(null, 'The configuration file could not be read.');
     }
     /**
      * $cid is the channel ID used in vars.php and is passed along in the URL so
      * that channel specific settings can be identified and loaded.
      */
     if (empty($settings[$this->cid])) {
         $this->output(null, 'This channel has not been configured.');
     }
     foreach ($settings[$this->cid] as $key => $value) {
         $this->{$key} = $value;
     }
     date_default_timezone_set($this->timezone);
     /**
      * Open the database connection.
      */
     try {
         $sqlite3 = new SQLite3($this->database, SQLITE3_OPEN_READONLY);
         $sqlite3->busyTimeout(0);
     } catch (Exception $e) {
         $this->output(null, basename(__FILE__) . ':' . __LINE__ . ', sqlite3 says: ' . $e->getMessage());
     }
     /**
      * Set SQLite3 PRAGMAs:
      *  query_only = ON - Disable all changes to database files.
      *  temp_store = MEMORY - Temporary tables and indices are kept in memory.
      */
     $pragmas = ['query_only' => 'ON', 'temp_store' => 'MEMORY'];
     foreach ($pragmas as $key => $value) {
         $sqlite3->exec('PRAGMA ' . $key . ' = ' . $value);
     }
     /**
      * Make stats!
      */
     echo $this->make_html($sqlite3);
     $sqlite3->close();
 }
开发者ID:zabouth,项目名称:superseriousstats,代码行数:46,代码来源:history.php

示例11: get_node_info

function get_node_info($nodename, $value)
{
    global $workdir;
    $db = new SQLite3("{$workdir}/var/db/nodes.sqlite");
    $db->busyTimeout(5000);
    if (!$db) {
        return;
    }
    $sql = "SELECT {$value} FROM nodelist WHERE nodename=\"{$nodename}\"";
    $result = $db->query($sql);
    //->fetchArray(SQLITE3_ASSOC);
    $row = array();
    while ($res = $result->fetchArray(SQLITE3_ASSOC)) {
        if (!isset($res["{$value}"])) {
            return;
        }
        return $res["{$value}"];
    }
}
开发者ID:mergar,项目名称:cw,代码行数:19,代码来源:nodes.inc.php

示例12: _connect

 protected function _connect()
 {
     $db = $this->profile['database'];
     if (preg_match('/^(app|lib|var|temp|www)\\:/', $db)) {
         $path = jFile::parseJelixPath($db);
     } else {
         if ($db[0] == '/' || preg_match('!^[a-z]\\:(\\\\|/)[a-z]!i', $db)) {
             if (file_exists($db) || file_exists(dirname($db))) {
                 $path = $db;
             } else {
                 throw new Exception('sqlite3 connector: unknown database path scheme');
             }
         } else {
             $path = jApp::varPath('db/sqlite3/' . $db);
         }
     }
     $sqlite = new SQLite3($path);
     // Load extensions if needed
     if (isset($this->profile['extensions'])) {
         $list = preg_split('/ *, */', $this->profile['extensions']);
         foreach ($list as $ext) {
             try {
                 $sqlite->loadExtension($ext);
             } catch (Exception $e) {
                 throw new Exception('sqlite3 connector: error while loading sqlite extension ' . $ext);
             }
         }
     }
     // set timeout
     if (isset($this->profile['busytimeout'])) {
         $timeout = intval($this->profile['busytimeout']);
         if ($timeout) {
             $sqlite->busyTimeout($timeout);
         }
     }
     return $sqlite;
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:37,代码来源:sqlite3.dbconnection.php

示例13: glob

    session_regenerate_id(true);
    session_start();
}
if (@$_GET['logout']) {
    session_regenerate_id(true);
}
// For debug purposes -> get random demo package from server
if (isset($_GET['demoPackages'])) {
    $demoFiles = glob(dirname(__FILE__) . '/demoData/*.json');
    die(file_get_contents($demoFiles[rand(0, count($demoFiles) - 1)]));
}
$errorMessages = array();
// try to get access to the database
try {
    $db = new SQLite3(dirname(__FILE__) . '/' . DB_FILE, SQLITE3_OPEN_READWRITE);
    $db->busyTimeout(1000 * intval(ini_get('max_execution_time')));
    // check table packages to be available in the right structure
    if ($stmt = @$db->prepare('PRAGMA table_info(packages)')) {
        $result = $stmt->execute();
        $givenStructure = array();
        while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
            $givenStructure[$row['name']] = $row['type'];
        }
        $neededStructure = array('id' => 'INTEGER', 'room' => 'TEXT', 'to_client' => 'TEXT', 'time' => 'INTEGER', 'data' => 'TEXT');
        if (count($neededStructure) == count($givenStructure)) {
            // check all fields
            foreach ($neededStructure as $name => $type) {
                // check whether col exists
                if (!isset($givenStructure[$name])) {
                    $errorMessages[] = 'Database table \'packages\' does not match the needed scheme. [Column \'' . $name . '\' is missing]';
                    http_response_code(500);
开发者ID:LucaVazz,项目名称:EduMon,代码行数:31,代码来源:mailbox.php

示例14: time

$bandwidth = $_GET['bw'];
$bandwidthlimit = $_GET['bwl'];
$mountpoints = $_GET['mnt'];
$load = $_GET['load'];
$loadlimit = $_GET['loadl'];
$tstampnow = time();
include "functions.php";
init_db();
error_reporting(E_ALL);
if (!isset($loadlimit)) {
    $loadlimit = 77;
}
if (!isset($ip, $bandwidth, $bandwidthlimit, $mountpoints, $load, $loadlimit)) {
    exit;
}
$maxage = 3600 * 24 * 31;
$maxagelimitstamp = $tstampnow - $maxage;
cleanup_pool($maxagelimitstamp);
$a_mountpoints = preg_split("/[|,]+/", $mountpoints);
$listeners = 99;
$db = new SQLite3('load.db');
$db->busyTimeout(3000);
foreach ($a_mountpoints as $mountpoint) {
    $a_listeners_per_mountpoint = preg_split("/[@]+/", $mountpoint);
    $listeners = $a_listeners_per_mountpoint[0];
    $mnt = $a_listeners_per_mountpoint[1];
    $target = $ip . "_" . $mnt;
    $db->exec("REPLACE INTO t_pool (\n\ttarget,\n\tmachineip,\n\tbandwidth,\n\tbandwidthlimit,\n\tlisteners,\n\tmountpoint,\n\tload,\n\tloadlimit,\n\ttimestamp) VALUES (\n\t'{$target}',\n\t'{$ip}',\n\t{$bandwidth},\n\t{$bandwidthlimit},\n\t{$listeners},\n\t'{$mnt}',\n\t{$load},\n\t{$loadlimit},\n\t{$tstampnow})");
}
$db->close();
#echo $db->lastErrorMsg();
开发者ID:xxaxxelxx,项目名称:xx_loadbalancer,代码行数:31,代码来源:update.php

示例15: sqliteConnect

 function sqliteConnect()
 {
     $s = new SQLite3("../wowsuchbots.db");
     $s->busyTimeout(1000);
     return $s;
 }
开发者ID:phxlol,项目名称:dogec0in,代码行数:6,代码来源:moonopoly.php


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