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


PHP Connection::applyLimit方法代码示例

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


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

示例1: executeQuery

 /**
  * Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query.
  * We support two signatures for this method:
  * - $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
  * - $stmt->executeQuery(array($param1, $param2), ResultSet::FETCHMODE_NUM);
  * @param mixed $p1 Either (array) Parameters that will be set using PreparedStatement::set() before query is executed or (int) fetchmode.
  * @param int $fetchmode The mode to use when fetching the results (e.g. ResultSet::FETCHMODE_NUM, ResultSet::FETCHMODE_ASSOC).
  * @return ResultSet
  * @throws SQLException if a database access error occurs.
  */
 public function executeQuery($p1 = null, $fetchmode = null)
 {
     $params = null;
     if ($fetchmode !== null) {
         $params = $p1;
     } elseif ($p1 !== null) {
         if (is_array($p1)) {
             $params = $p1;
         } else {
             $fetchmode = $p1;
         }
     }
     foreach ((array) $params as $i => $param) {
         $this->set($i + 1, $param);
         unset($i, $param);
     }
     unset($params);
     $this->updateCount = null;
     // reset
     $sql = $this->replaceParams();
     if ($this->limit > 0 || $this->offset > 0) {
         $this->conn->applyLimit($sql, $this->offset, $this->limit);
     }
     $this->resultSet = $this->conn->executeQuery($sql, $fetchmode);
     return $this->resultSet;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:36,代码来源:PreparedStatementCommon.php

示例2: executeQuery

 /**
  * Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query.
  * We support two signatures for this method:
  * - $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
  * - $stmt->executeQuery(array($param1, $param2), ResultSet::FETCHMODE_NUM);
  * @param mixed $p1 Either (array) Parameters that will be set using PreparedStatement::set() before query is executed or (int) fetchmode.
  * @param int $fetchmode The mode to use when fetching the results (e.g. ResultSet::FETCHMODE_NUM, ResultSet::FETCHMODE_ASSOC).
  * @return ResultSet
  * @throws SQLException if a database access error occurs.
  */
 public function executeQuery($p1 = null, $fetchmode = null)
 {
     $params = null;
     if ($fetchmode !== null) {
         $params = $p1;
     } elseif ($p1 !== null) {
         if (is_array($p1)) {
             $params = $p1;
         } else {
             $fetchmode = $p1;
         }
     }
     if ($params) {
         for ($i = 0, $cnt = count($params); $i < $cnt; $i++) {
             $this->set($i + 1, $params[$i]);
         }
     }
     $this->updateCount = null;
     // reset
     $sql = $this->replaceParams();
     if ($this->limit > 0 || $this->offset > 0) {
         $this->conn->applyLimit($sql, $this->offset, $this->limit);
     }
     $this->resultSet = $this->conn->executeQuery($sql, $fetchmode);
     return $this->resultSet;
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:36,代码来源:PreparedStatementCommon.php

示例3: testApplyLimit

 /**
  * Test the applyLimit() method.  By default this method will not modify the values provided.
  * Subclasses must override this method to test for appropriate SQL modifications.
  */
 public function testApplyLimit()
 {
     $sql = "SELECT * FROM sampletable WHERE category = 5";
     $offset = 5;
     $limit = 50;
     $this->conn->applyLimit($sql, $offset, $limit);
     $this->assertEquals("SELECT * FROM sampletable WHERE category = 5 LIMIT 50 OFFSET 5", $sql);
 }
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:12,代码来源:ConnectionTest.php

示例4: executeQuery

 /**
  * Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query.
  * 
  * @param string $sql This method may optionally be called with the SQL statement.
  * @param int $fetchmode The mode to use when fetching the results (e.g. ResultSet::FETCHMODE_NUM, ResultSet::FETCHMODE_ASSOC).
  * @return object Creole::ResultSet
  * @throws SQLException If there is an error executing the specified query.
  * @todo -cStatementCommon Put native query execution logic in statement subclasses.
  */
 public function executeQuery($sql, $fetchmode = null)
 {
     $this->updateCount = null;
     if ($this->limit > 0 || $this->offset > 0) {
         $this->conn->applyLimit($sql, $this->offset, $this->limit);
     }
     $this->resultSet = $this->conn->executeQuery($sql, $fetchmode);
     return $this->resultSet;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:18,代码来源:StatementCommon.php

示例5: applyLimit

 /**
  * @see Connection::applyLimit()
  */
 public function applyLimit(&$sql, $offset, $limit)
 {
     $this->log("applyLimit(): {$sql}, offset: {$offset}, limit: {$limit}");
     return $this->childConnection->applyLimit($sql, $offset, $limit);
 }
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:8,代码来源:DebugConnection.php

示例6: applyLimit

 /**
  * @see Connection::applyLimit()
  */
 public function applyLimit(&$sql, $offset, $limit)
 {
     //$this->log("applyLimit(): $sql, offset: $offset, limit: $limit");
     return $this->childConnection->applyLimit($sql, $offset, $limit);
 }
开发者ID:rrsc,项目名称:processmaker,代码行数:8,代码来源:DebugConnection.php

示例7: applyLimit

 /**
  * @see Connection::applyLimit()
  */
 public function applyLimit(&$sql, $offset, $limit)
 {
     krumo('DBArrayConnection applyLimit ');
     die;
     $this->log("applyLimit(): {$sql}, offset: {$offset}, limit: {$limit}");
     return $this->childConnection->applyLimit($sql, $offset, $limit);
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:10,代码来源:DBArrayConnection.php


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