當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sqlite_changes函數代碼示例

本文整理匯總了PHP中sqlite_changes函數的典型用法代碼示例。如果您正苦於以下問題:PHP sqlite_changes函數的具體用法?PHP sqlite_changes怎麽用?PHP sqlite_changes使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了sqlite_changes函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exec

 public function exec(&$statement)
 {
     if (@sqlite_exec($this->link, $statement)) {
         return sqlite_changes($this->link);
     }
     return false;
 }
開發者ID:nurirahmat,項目名稱:Yii-Extensions,代碼行數:7,代碼來源:sqlite2.php

示例2: SqliteResultSet

 /**
  * Constructs a new SqliteResultSet
  *
  * \param $sql
  *   The sql query to execute.
  *
  * \param $backend
  *   A reference to the used backend.
  */
 function SqliteResultSet($sql, &$backend)
 {
     assert('is_string($sql)');
     $this->sql = $sql;
     $this->backend =& $backend;
     $this->rs = sqlite_query($this->backend->handle, $sql) or trigger_error(sprintf('Query failed (%s)', sqlite_error_string(sqlite_last_error($this->backend->handle))), E_USER_ERROR);
     $this->rows_affected = sqlite_changes($this->backend->handle);
 }
開發者ID:jijkoun,項目名稱:ssscrape,代碼行數:17,代碼來源:resultset.lib.php

示例3: _doExec

 protected function _doExec($query)
 {
     if ($qI = sqlite_query($query, $this->_connection)) {
         return sqlite_changes($this->_connection);
     } else {
         throw new jException('jelix~db.error.query.bad', sqlite_error_string($this->_connection) . '(' . $query . ')');
     }
 }
開發者ID:alienpham,項目名稱:helenekling,代碼行數:8,代碼來源:sqlite.dbconnection.php

示例4: sql_affected_rows

function sql_affected_rows()
{
    global $con;
    if (DB_TYPE == 'mysql') {
        $sql = mysql_affected_rows();
    } elseif (DB_TYPE == 'sqlite') {
        $sql = sqlite_changes($con);
    }
    return $sql;
}
開發者ID:eodivision,項目名稱:eoCMS,代碼行數:10,代碼來源:sql_affected_rows.php

示例5: getLength

 public function getLength()
 {
     if ($this->r === true) {
         return sqlite_changes($this->r);
     } else {
         if ($this->r === false) {
             return 0;
         }
     }
     return sqlite_num_rows($this->r);
 }
開發者ID:marcdraco,項目名稱:Webrathea,代碼行數:11,代碼來源:SqliteResultSet.class.php

示例6: 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

示例7: _query

 protected function _query($sql)
 {
     $result = sqlite_query($this->_connection, $sql);
     $error = sqlite_last_error($this->_connection);
     $this->_errorHandler($error, $error != 0 ? sqlite_error_string($error) : '');
     if ($result && $this->queryHasResultSet($sql)) {
         $this->_numRows = sqlite_num_rows($result);
         $resultObject = $this->createRecordsetObject();
         $resultObject->setResult($result);
     } else {
         $this->_numRows = sqlite_changes($this->_connection);
         $resultObject = $this->createResultObject();
     }
     return $resultObject;
 }
開發者ID:TheProjecter,項目名稱:skeleton,代碼行數:15,代碼來源:Sqlite.php

示例8: __construct

 /**
  * Run a query
  *
  * @param string $sql
  * @param resource $connection DB Connection
  * @throws Exception MySQL error
  */
 public function __construct($sql, $connection)
 {
     parent::__construct($sql);
     $this->connection = $connection;
     $errorMessage = '';
     // Overwritten by sqlite_query
     $resource = sqlite_query($this->connection, $sql, SQLITE_ASSOC, $errorMessage);
     if (false === $resource) {
         throw new Exception('SQLite Error: ' . $errorMessage);
     } else {
         $this->resource = $resource;
         $this->setNumberOfRows(sqlite_num_rows($resource));
         $this->columns = $this->getColumnTypes();
         $this->rowsAffected = sqlite_changes($this->connection);
         $this->lastId = sqlite_last_insert_rowid($this->connection);
     }
 }
開發者ID:chrismcmacken,項目名稱:phptools,代碼行數:24,代碼來源:Result.php

示例9: execute

function execute($db, $sql)
{
    if (IS_SQLITE3) {
        if ($db->query($sql)) {
            return $db->changes();
        } else {
            return false;
        }
    } else {
        if (sqlite_query($db, $sql, 0666, $error)) {
            //echo "<font color='red'>1.".$error."</font>";
            return sqlite_changes($db);
        } else {
            //echo "<font color='red'>2.".$error."</font>";
            return false;
        }
    }
}
開發者ID:nofastfat,項目名稱:nofastfat-mobile,代碼行數:18,代碼來源:connection.php

示例10: query

 /**
  * SQLite::query()
  * 
  * @param mixed $sql
  * @return
  */
 public function query($sql)
 {
     $data = array();
     $i = 0;
     $err_msg = "";
     $result = sqlite_query($this->conn, $sql, SQLITE_ASSOC, $err_msg);
     if ($result == false) {
         throw new Exception("{$sql}<br />執行錯誤:" . $err_msg);
     } else {
         while ($arr = sqlite_fetch_array($result, SQLITE_ASSOC)) {
             $data[$i++] = $arr;
         }
     }
     if (count($data) > 0) {
         return $data;
     } else {
         return sqlite_changes($this->conn);
     }
 }
開發者ID:yemasky,項目名稱:my,代碼行數:25,代碼來源:SQLite.class.php

示例11: getAffectedRows

 function getAffectedRows()
 {
     return sqlite_changes($this->conn);
 }
開發者ID:guohuadeng,項目名稱:stampApp,代碼行數:4,代碼來源:sqlite.php

示例12: affectedRows

 /**
  * Gets the number of rows affected by a query.
  *
  * @return number of rows affected by the last query
  */
 function affectedRows()
 {
     return @sqlite_changes($this->connection);
 }
開發者ID:bantudevelopment,項目名稱:polysmis,代碼行數:9,代碼來源:sqlite.php

示例13: __construct

 public function __construct($sql, $connection_handle, $result_set_handle)
 {
     parent::__construct($sql, $connection_handle, $result_set_handle);
     $this->n_rows = sqlite_num_rows($result_set_handle);
     $this->n_rows_affected = sqlite_changes($connection_handle);
 }
開發者ID:jijkoun,項目名稱:ssscrape,代碼行數:6,代碼來源:backend-sqlite.lib.php

示例14: setAffectedRows

 /**
  * Sets the number of rows affected by the query
  * 
  * @param  fResult $result    The result object for the query
  * @param  mixed   $resource  Only applicable for `ibm_db2`, `pdo`, `oci8` and `sqlsrv` extentions or `mysqli` prepared statements - this is either the `PDOStatement` object, `mysqli_stmt` object or the `oci8` or `sqlsrv` resource
  * @return void
  */
 private function setAffectedRows($result, $resource = NULL)
 {
     if ($this->extension == 'ibm_db2') {
         $insert_update_delete = preg_match('#^\\s*(INSERT|UPDATE|DELETE)\\b#i', $result->getSQL());
         $result->setAffectedRows(!$insert_update_delete ? 0 : db2_num_rows($resource));
     } elseif ($this->extension == 'mssql') {
         $affected_rows_result = mssql_query('SELECT @@ROWCOUNT AS rows', $this->connection);
         $result->setAffectedRows((int) mssql_result($affected_rows_result, 0, 'rows'));
     } elseif ($this->extension == 'mysql') {
         $result->setAffectedRows(mysql_affected_rows($this->connection));
     } elseif ($this->extension == 'mysqli') {
         if (is_object($resource)) {
             $result->setAffectedRows($resource->affected_rows);
         } else {
             $result->setAffectedRows(mysqli_affected_rows($this->connection));
         }
     } elseif ($this->extension == 'oci8') {
         $result->setAffectedRows(oci_num_rows($resource));
     } elseif ($this->extension == 'pgsql') {
         $result->setAffectedRows(pg_affected_rows($result->getResult()));
     } elseif ($this->extension == 'sqlite') {
         $result->setAffectedRows(sqlite_changes($this->connection));
     } elseif ($this->extension == 'sqlsrv') {
         $result->setAffectedRows(sqlsrv_rows_affected($resource));
     } elseif ($this->extension == 'pdo') {
         // This fixes the fact that rowCount is not reset for non INSERT/UPDATE/DELETE statements
         try {
             if (!$resource || !$resource->fetch()) {
                 throw new PDOException();
             }
             $result->setAffectedRows(0);
         } catch (PDOException $e) {
             // The SQLite PDO driver seems to return 1 when no rows are returned from a SELECT statement
             if ($this->type == 'sqlite' && $this->extension == 'pdo' && preg_match('#^\\s*SELECT#i', $result->getSQL())) {
                 $result->setAffectedRows(0);
             } elseif (!$resource) {
                 $result->setAffectedRows(0);
             } else {
                 $result->setAffectedRows($resource->rowCount());
             }
         }
     }
 }
開發者ID:JhunCabas,項目名稱:material-management,代碼行數:50,代碼來源:fDatabase.php

示例15: rowCount

 public function rowCount()
 {
     return sqlite_changes($this->_link);
 }
開發者ID:Deepab23,項目名稱:clinic,代碼行數:4,代碼來源:sqlite2_statement.php


注:本文中的sqlite_changes函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。