当前位置: 首页>>代码示例>>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;未经允许,请勿转载。