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


PHP sqlite_unbuffered_query函数代码示例

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


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

示例1: query

 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
         $q_start = forum_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @sqlite_unbuffered_query($this->link_id, $sql);
     } else {
         $this->query_result = @sqlite_query($this->link_id, $sql);
     }
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', forum_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @sqlite_last_error($this->link_id);
         $this->error_msg = @sqlite_error_string($this->error_no);
         if ($this->in_transaction) {
             @sqlite_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:torepublicStartpageCode,项目名称:torepublic2,代码行数:32,代码来源:sqlite.php

示例2: sendQuery

 /**
  * Method to send SQL query
  *
  * @param   resource    $res_conn
  * @return  void
  */
 private function sendQuery($res_conn)
 {
     // checking query type
     // if the query return recordset or not
     if (preg_match("/^(SELECT)\\s/i", $this->sql_string)) {
         $this->res_result = @sqlite_query($res_conn, $this->sql_string);
         // error checking
         if (!$this->res_result) {
             $this->errno = sqlite_last_error($res_conn);
             $this->error = "Query failed to executed. Please check your query again. \n" . sqlite_error_string($this->errno);
         } else {
             // count number of rows
             $this->num_rows = @sqlite_num_rows($this->res_result);
         }
     } else {
         $_query = @sqlite_unbuffered_query($res_conn, $this->sql_string);
         $this->insert_id = sqlite_last_insert_rowid($res_conn);
         // error checking
         if (!$_query) {
             $this->errno = sqlite_last_error($res_conn);
             $this->error = "Query failed to executed. Please check your query again. \n" . sqlite_error_string($this->errno);
         } else {
             // get number of affected row
             $this->affected_rows = @sqlite_changes($res_conn);
         }
         // nullify query
         $_query = null;
     }
 }
开发者ID:purwoko,项目名称:SENAYAN-3-Stable,代码行数:35,代码来源:simbio_sqlite_result.inc.php

示例3: write_data

 /**
  * {@inheritdoc}
  */
 public function write_data($table_name)
 {
     if (!$this->is_initialized) {
         throw new extractor_not_initialized_exception();
     }
     $col_types = sqlite_fetch_column_types($this->db->get_db_connect_id(), $table_name);
     $sql = "SELECT *\n\t\t\tFROM {$table_name}";
     $result = sqlite_unbuffered_query($this->db->get_db_connect_id(), $sql);
     $rows = sqlite_fetch_all($result, SQLITE_ASSOC);
     $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES (';
     foreach ($rows as $row) {
         foreach ($row as $column_name => $column_data) {
             if (is_null($column_data)) {
                 $row[$column_name] = 'NULL';
             } else {
                 if ($column_data == '') {
                     $row[$column_name] = "''";
                 } else {
                     if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false) {
                         $row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data));
                     }
                 }
             }
         }
         $this->flush($sql_insert . implode(', ', $row) . ");\n");
     }
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:30,代码来源:sqlite_extractor.php

示例4: query

 function query($sql, $unbuffered = false)
 {
     if (defined('LUNA_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @sqlite_unbuffered_query($this->link_id, $sql);
     } else {
         $this->query_result = @sqlite_query($this->link_id, $sql);
     }
     if ($this->query_result) {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @sqlite_last_error($this->link_id);
         $this->error_msg = @sqlite_error_string($this->error_no);
         if ($this->in_transaction) {
             @sqlite_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:29,代码来源:sqlite.php

示例5: query

 /**
  * クエリを実行する。
  * 
  * @param	string	$query	SQL文。
  * @return	Resource	$result	失敗した場合は例外を投げる。
  */
 function query($query)
 {
     $result = sqlite_unbuffered_query($this->link, $query);
     if ($result == false) {
         throw new DBException('クエリを実行できませんでした。', $query, $this->link);
     }
     return $result;
 }
开发者ID:riaf,项目名称:kinowiki,代码行数:14,代码来源:database.inc.php

示例6: queryAndFetch

 /**
  * 执行一个数据库查询语句,并返回第一行结果
  * @param string $sql
  * @return array
  * @throws Exception
  */
 public function queryAndFetch($sql)
 {
     if (!$this->db) {
         throw new Exception("sqlite db not connected error");
     }
     if ($this->sqlite_version == 2) {
         return sqlite_fetch_array(sqlite_unbuffered_query($this->db, $sql));
     } else {
         return $this->db->query($sql)->fetch();
     }
 }
开发者ID:sophia2152,项目名称:php-IpLocationSeeker,代码行数:17,代码来源:IpLocationSeekerSqlite.php

示例7: query

 public function query($query)
 {
     $result_set = sqlite_unbuffered_query($query, $this->_connection, $this->_dbinfo);
     if ($result_set) {
         $result = array();
         while ($row = sqlite_fetch_array($result_set, SQLITE_ASSOC)) {
             array_push($result, $row);
         }
     } else {
         $this->_setErrors('SQLER');
         $result = false;
     }
     return $result;
 }
开发者ID:silentworks,项目名称:the-compressor,代码行数:14,代码来源:DoSqlite.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: connect

 function connect($_DB)
 {
     $this->pre = $_DB['prefix'];
     if ($this->pconnect) {
         $this->conn = sqlite_popen(INC_P . '/data/' . $_DB['database'], 0666, $sqliteerror);
     } else {
         $this->conn = sqlite_open(INC_P . '/data/' . $_DB['database'], 0666, $sqliteerror);
     }
     if (!$this->conn) {
         var_dump($sqliteerror);
         $this->halt("Can not connect SQLite Database");
     }
     if ($_DB['charset']) {
         @sqlite_unbuffered_query("SET NAMES '" . $_DB['charset'] . "'");
     }
     return true;
 }
开发者ID:rust1989,项目名称:edit,代码行数:17,代码来源:db_sqlite.php

示例10: query

 function query($query)
 {
     parent::query($query);
     if ($this->db != null) {
         // submit query
         $this->result = @sqlite_unbuffered_query($this->db, $query);
         if ($this->result != false) {
             return true;
             // save error msg
         } else {
             $this->error = @sqlite_error_string(sqlite_last_error($this->db));
             $this->result = null;
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:18,代码来源:SQLiteDB.php

示例11: query

 function query($sql, $unbuffered = false)
 {
     if ($unbuffered) {
         $this->query_result = @sqlite_unbuffered_query($this->link_id, $sql);
     } else {
         $this->query_result = @sqlite_query($this->link_id, $sql);
     }
     if ($this->query_result) {
         if (defined('EPS_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         return $this->query_result;
     } else {
         if (defined('EPS_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @sqlite_last_error($this->link_id);
         $this->error_msg = @sqlite_error_string($this->error_no);
         return false;
     }
 }
开发者ID:nqv,项目名称:eposys,代码行数:21,代码来源:class_sqlite.php

示例12: query

 function query($sqlString, $buffered = true, $assign = true)
 {
     if (substr(trim($sqlString), -1) != ';') {
         $sqlString .= ';';
     }
     if ($buffered) {
         if (DEBUG) {
             $resId = sqlite_query($this->connId, $sqlString);
         } else {
             $resId = @sqlite_query($this->connId, $sqlString);
         }
     } else {
         if (DEBUG) {
             $resId = sqlite_unbuffered_query($this->connId, $sqlString);
         } else {
             $resId = @sqlite_unbuffered_query($this->connId, $sqlString);
         }
     }
     if ($assign) {
         $this->resId = $resId;
     }
     return $resId;
 }
开发者ID:ve3sjk,项目名称:45Farms-YieldBuddy-Merged,代码行数:23,代码来源:sqlite_2.class.php

示例13: query

 /**
  * Executes the SQL query.
  *
  * @param  string      SQL statement.
  * @return IDibiDriver|NULL
  * @throws DibiDriverException
  */
 public function query($sql)
 {
     DibiDriverException::tryError();
     if ($this->buffered) {
         $this->resultSet = sqlite_query($this->connection, $sql);
     } else {
         $this->resultSet = sqlite_unbuffered_query($this->connection, $sql);
     }
     if (DibiDriverException::catchError($msg)) {
         throw new DibiDriverException($msg, sqlite_last_error($this->connection), $sql);
     }
     return is_resource($this->resultSet) ? clone $this : NULL;
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:20,代码来源:sqlite.php

示例14: file_put_contents

 if ($subject) {
     $flag = null;
     if (!strstr($subject, "note " . $lastid)) {
         /* File an error but hold the data in the queue. errorcode GTK_444 */
         file_put_contents($stats, "GTK_444: {$lastid} held in queue\n", FILE_APPEND);
         if (strstr($subject, "note " . $id)) {
             /* NNTP might have been too fast for us! */
             $lastid = $id;
             $lastemail = $email;
             $lastpage = $page;
             $flag = true;
         }
     } else {
         /* If we're working with $lastid, we need to get the data out of the queue db first */
         $queuedb = sqlite_open($queuefile);
         $query = sqlite_unbuffered_query($db, "SELECT * FROM notes WHERE id = {$lastid}", SQLITE_ASSOC, &$errcode);
         if (!$query || $errcode) {
             sqlite_close($queuedb);
             file_put_contents($stats, "{$errcode}:{$lastid} (failed SQL query)\n", FILE_APPEND);
         } else {
             $last = sqlite_fetch_array($query, SQLITE_ASSOC);
             $lastpage = $last['page'];
             $lastemail = $last['email'];
             $db_string = '("' . $lastid . '", "' . $lastpage . '", "' . $last['lang'] . '", "' . $last['date'] . '", "' . $lastemail . '", "' . $last['display'] . '", "' . $last['note'] . '")';
             sqlite_close($queuedb);
             $flag = true;
         }
     }
     if ($flag) {
         $notesdb = sqlite_open($notesfile);
         $result = sqlite_exec($notesdb, "INSERT INTO notes VALUES {$db_string}");
开发者ID:phpsource,项目名称:web-gtk,代码行数:31,代码来源:add-note.php

示例15: executeUnbufferedQuery

 /**
  * Executes an unbuffered SQL query
  * 
  * @param  fUnbufferedResult $result  The result object for the query
  * @return void
  */
 private function executeUnbufferedQuery($result)
 {
     $old_level = error_reporting(error_reporting() & ~E_WARNING);
     if ($this->extension == 'mssql') {
         $result->setResult(mssql_query($result->getSQL(), $this->connection, 20));
     } elseif ($this->extension == 'mysql') {
         $result->setResult(mysql_unbuffered_query($result->getSQL(), $this->connection));
     } elseif ($this->extension == 'mysqli') {
         $result->setResult(mysqli_query($this->connection, $result->getSQL(), MYSQLI_USE_RESULT));
     } elseif ($this->extension == 'oci8') {
         $oci_statement = oci_parse($this->connection, $result->getSQL());
         $result->setResult(oci_execute($oci_statement, $this->inside_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS) ? $oci_statement : FALSE);
     } elseif ($this->extension == 'odbc') {
         $result->setResult(odbc_exec($this->connection, $result->getSQL()));
     } elseif ($this->extension == 'pgsql') {
         $result->setResult(pg_query($this->connection, $result->getSQL()));
     } elseif ($this->extension == 'sqlite') {
         $result->setResult(sqlite_unbuffered_query($this->connection, $result->getSQL(), SQLITE_ASSOC, $sqlite_error_message));
     } elseif ($this->extension == 'sqlsrv') {
         $result->setResult(sqlsrv_query($this->connection, $result->getSQL()));
     } elseif ($this->extension == 'pdo') {
         $result->setResult($this->connection->query($result->getSQL()));
     }
     error_reporting($old_level);
     if ($this->extension == 'sqlite') {
         $this->checkForError($result, $sqlite_error_message);
     } elseif ($this->extension == 'oci8') {
         $this->checkForError($result, $oci_statement);
     } else {
         $this->checkForError($result);
     }
 }
开发者ID:jsuarez,项目名称:MyDesign,代码行数:38,代码来源:fDatabase.php


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