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


PHP sqlite_exec函数代码示例

本文整理汇总了PHP中sqlite_exec函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_exec函数的具体用法?PHP sqlite_exec怎么用?PHP sqlite_exec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: query

 /**
  * 执行mysql query()操作
  * @param string $sql
  * @return mixed
  */
 public function query($sql)
 {
     // 是否记录 SQL log
     if (true == C('sql_log')) {
         wlog('SQL-Log', $sql);
     }
     $error_msg = '';
     $_key = strtolower(substr($sql, 0, 6));
     if ($_key == 'select') {
         $rs = sqlite_query($this->db, $sql, SQLITE_BOTH, $error_msg);
     } else {
         $rs = sqlite_exec($this->db, $sql, $error_msg);
     }
     if (!empty($rs)) {
         $GLOBALS['run_dbquery_count']++;
         return $rs;
     } else {
         if (C('show_errors')) {
             show_error('执行sqlite_query()出现错误: ' . $error_msg . '<br />原SQL: ' . $sql);
         } else {
             exit('db_sqlite2::query() error.');
         }
     }
     //return false;
 }
开发者ID:wangxian,项目名称:ePHP,代码行数:30,代码来源:db_sqlite2.class.php

示例2: exec

 /**
  * 結果を返さないクエリを実行する。
  * 
  * @param	string	$query	SQL文。
  * @return	void
  */
 function exec($query)
 {
     $result = sqlite_exec($this->link, $query);
     if ($result == false) {
         throw new DBException('クエリを実行できませんでした。', $query, $this->link);
     }
 }
开发者ID:riaf,项目名称:kinowiki,代码行数:13,代码来源:database.inc.php

示例3: exec

 function exec($query)
 {
     $this->error = "";
     if ($this->versi == 3) {
         return $this->db->exec($query);
     } else {
         return sqlite_exec($this->db, $query, $this->error);
     }
 }
开发者ID:HuiZone,项目名称:Waruga,代码行数:9,代码来源:sqlite.php

示例4: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     //Abre una conexión SqLite a la base de datos cache
     $this->_db = sqlite_open(':memory:');
     $result = sqlite_query($this->_db, "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND tbl_name='cache' ");
     $count = sqlite_fetch_single($result);
     if (!$count) {
         sqlite_exec($this->_db, ' CREATE TABLE cache (id TEXT, "group" TEXT, value TEXT, lifetime TEXT) ');
     }
     return $this->_db;
 }
开发者ID:jaigjaig,项目名称:usuario_auth_template_bootstrap,代码行数:14,代码来源:memsqlite_cache.php

示例5: hasListing

 public function hasListing($a_sListingURL)
 {
     $l_sTmp = md5($a_sListingURL);
     $result = sqlite_query($this->db, "SELECT * FROM listings WHERE l_id = '" . $l_sTmp . "'");
     $rows = sqlite_num_rows($result);
     if ($rows < 1) {
         $result = sqlite_exec($this->db, "INSERT INTO listings VALUES ('{$l_sTmp}')");
         return false;
     } else {
         return true;
     }
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:12,代码来源:CSqliteDB.class.php

示例6: execute

 public function execute($sql, $params = array())
 {
     foreach ($params as $k => $v) {
         $sql = str_replace(':' . $k, $this->escape($v), $sql);
     }
     $this->sql = $sql;
     if ($query = sqlite_exec($this->_getWriteLink(), $sql, $error_msg)) {
         return $query;
     } else {
         $this->error($error_msg);
     }
 }
开发者ID:JamesKid,项目名称:teach,代码行数:12,代码来源:cpSqlite2.class.php

示例7: exec

 public function exec($sql, $connResource)
 {
     if (empty($sql)) {
         return 0;
     }
     sqlite_exec($connResource, $sql);
     // echo '<pre>';
     // print_r(debug_backtrace());
     // debug_print_backtrace();
     // echo '</pre>';
     // delete from table 结果为0,原因未知。
     // 使用 delete from table where 1 能返回正确结果
     return sqlite_changes($connResource);
 }
开发者ID:kwdwkiss,项目名称:trial,代码行数:14,代码来源:DbConnectionAdapterSqlite.php

示例8: add

 public function add($ip, $comment)
 {
     $comment = self::trunc($comment);
     $ip = "'" . sqlite_escape_string($ip) . "'";
     if ($comment == '') {
         sqlite_exec($this->handle, "delete from comments where ip=" . $ip, $this->error);
     } else {
         $comment = "'" . sqlite_escape_string($comment) . "'";
         if (($query = sqlite_unbuffered_query($this->handle, "select count(comment) from comments where ip=" . $ip, SQLITE_ASSOC, $this->error)) && sqlite_fetch_single($query)) {
             sqlite_exec($this->handle, "update comments set comment=" . $comment . " where ip=" . $ip, $this->error);
         } else {
             sqlite_exec($this->handle, "insert into comments (ip,comment) values (" . $ip . "," . $comment . ")", $this->error);
         }
     }
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:15,代码来源:ip_db.php

示例9: exec

 public function exec($sql)
 {
     if (strtolower(substr($sql, 0, 6)) == 'select') {
         $res = sqlite_query($this->dbcon, $sql, SQLITE_BOTH, $error_msg);
         if ($error_msg) {
             echo 'Query Error: ' . $error_msg;
         }
     } else {
         $res = sqlite_exec($this->dbcon, $sql, $error_msg);
         if ($error_msg) {
             echo 'Query Error: ' . $error_msg;
         }
     }
     return $res;
 }
开发者ID:hendisantika,项目名称:ajax-crud-bootstrap,代码行数:15,代码来源:sqlite.php

示例10: formthrottle_too_many_submissions

function formthrottle_too_many_submissions($ip)
{
    $tooManySubmissions = false;
    if (function_exists("sqlite_open") and $db = @sqlite_open('muse-throttle-db', 0666, $sqliteerror)) {
        $ip = @sqlite_escape_string($ip);
        @sqlite_exec($db, "DELETE FROM Submission_History WHERE Submission_Date < DATETIME('now','-2 hours')", $sqliteerror);
        @sqlite_exec($db, "INSERT INTO Submission_History (IP,Submission_Date) VALUES ('{$ip}', DATETIME('now'))", $sqliteerror);
        $res = @sqlite_query($db, "SELECT COUNT(1) FROM Submission_History WHERE IP = '{$ip}';", $sqliteerror);
        if (@sqlite_num_rows($res) > 0 and @sqlite_fetch_single($res) > 25) {
            $tooManySubmissions = true;
        }
        @sqlite_close($db);
    }
    return $tooManySubmissions;
}
开发者ID:01J,项目名称:silviadivina-html,代码行数:15,代码来源:form_throttle.php

示例11: connect

function connect()
{
    if (!file_exists(FILE)) {
        $initReq = true;
    }
    $GLOBALS['sqlConnect'] = sqlite_open(FILE, 0666);
    if (!$GLOBALS['sqlConnect']) {
        return false;
    }
    if ($initReq) {
        $initSQL = "CREATE TABLE wwwsqldesigner (\r\n                          keyword varchar(30) NOT NULL default '',\r\n                          data TEXT ,\r\n                          dt DATETIME DEFAULT CURRENT_TIMESTAMP ,\r\n                          PRIMARY KEY ( keyword )\r\n                        );";
        $res = sqlite_exec($initSQL, $GLOBALS['sqlConnect']);
        return $res;
    }
    return true;
}
开发者ID:jphpsf,项目名称:sfSqlDesignerPlugin,代码行数:16,代码来源:index.php

示例12: setup

 public function setup($cacheinfo)
 {
     //check if the db has been setup
     $this->cachebase = "app/cache/";
     if (!empty($cacheinfo)) {
         $this->cachefile = $cacheinfo['dbname'];
     }
     $this->cachefile = $this->cachebase . $this->cachefile;
     if (!file_exists($this->cachefile)) {
         $this->cachedb = sqlite_open($this->cachefile, 0666);
         sqlite_exec("create table cache ( marker VARCHAR PRIMARY KEY, content TEXT, modified INT, valid INT, expired INTEGER DEFAULT 0)  ", $this->cachedb);
         //sqlite_exec("create index marker on cache (marker)  ",$this->cachedb);
     } else {
         $this->cachedb = sqlite_open($this->cachefile, 0666);
     }
 }
开发者ID:mustafakarali,项目名称:orchidframework,代码行数:16,代码来源:cachesqlite.php

示例13: open

 public static function open()
 {
     // connect
     $error_msg = null;
     define('SESSION_DB_LINK', sqlite_open(DIR_DATA . '/sessions.db', 0666, $error_msg));
     if (!SESSION_DB_LINK) {
         warning("Can't open session database: {$error_msg}");
         return false;
     }
     // check if required table exists, create it if necessary
     $R = sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND name='sess'", SESSION_DB_LINK);
     if (!sqlite_num_rows($R)) {
         sqlite_exec("CREATE TABLE sess (id TEXT, data TEXT, expire INT)", SESSION_DB_LINK);
     }
     return true;
 }
开发者ID:laiello,项目名称:php-garden,代码行数:16,代码来源:session.php

示例14: login

 public function login($user, $password, $stayloggedin = false)
 {
     $user = sqlite_escape_string($user);
     $password = md5($salt . $password);
     $q = "SELECT * FROM users WHERE username = '{$user}' AND password = '{$password}' LIMIT 1";
     $res = sqlite_query($this->db, $q, $e);
     if (sqlite_num_rows($res) > 0) {
         if ($stayloggedin) {
             $r = sqlite_fetch_array($res);
             setcookie("userid", $r['uid'], time() + 60 * 60 * 24 * 30);
             setcookie("pass", $password, time() + 60 * 60 * 24 * 30);
         }
         $_SESSION['uid'] = $r['uid'];
         $_SESSION['uname'] = $r['username'];
         $time = time();
         $id = $r['uid'];
         sqlite_exec($this->db, "UPDATE users SET lastlogin = '{$time}' WHERE uid = '{$id}'", $e);
         return true;
     }
     return false;
 }
开发者ID:raccoon4me,项目名称:sqlite-user-auth,代码行数:21,代码来源:userauth.php

示例15: exec

 public function exec($query)
 {
     # This method executes a query.
     # @param string $query
     # @return boolean
     global $sqlite, $syslog;
     ob_start();
     // Start catching error messages
     if (sqlite_exec($sqlite->handle, $query)) {
         ob_end_clean();
         $syslog->success('SQLObject', 'exec()', $query);
         return true;
     } else {
         $this->error = strip_tags(ob_get_contents(), '<strong><b>');
         // Get the error message from the buffer
         $this->sqlite_error = sqlite_error_string(sqlite_last_error($sqlite->handle));
         // Get the error message of the error code
         ob_end_clean();
         $syslog->error('SQLObject', 'exec()', $query, $this->sqlite_error);
         return false;
     }
 }
开发者ID:jankuca,项目名称:smog-cms,代码行数:22,代码来源:sqlite.layer.php


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