本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}