本文整理汇总了PHP中QueryBuilder::getLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::getLimit方法的具体用法?PHP QueryBuilder::getLimit怎么用?PHP QueryBuilder::getLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::getLimit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_result_set
/**
* Creates a ResultSet from a QueryBuilder
*
* @return ResultSet
*/
protected static function create_result_set(QueryBuilder $builder)
{
$timer = new MTimer();
$stmt = ActiveRecord::connection()->prepareStatement($builder->compile()->getQueryString());
$i = 1;
foreach ($builder->getBindings() as $binding) {
$stmt->set($i++, $binding);
}
if ($limit = $builder->getLimit()) {
$stmt->setLimit($limit);
}
if ($offset = $builder->getOffset()) {
$stmt->setOffset($offset);
}
$rs = $stmt->executeQuery();
ActiveRecord::log($timer);
$stmt->close();
return $rs;
}
示例2: create_result_set
/**
* Creates a ResultSet from a QueryBuilder
*
* @return ResultSet
*/
protected static function create_result_set(QueryBuilder $builder)
{
$stmt = ActiveRecord::connection()->prepareStatement($builder->compile()->getQueryString());
$i = 1;
foreach ($builder->getBindings() as $binding) {
$stmt->set($i++, $binding);
}
if ($limit = $builder->getLimit()) {
$stmt->setLimit($limit);
}
if ($offset = $builder->getOffset()) {
$stmt->setOffset($offset);
}
$rs = $stmt->executeQuery();
Registry::get('__logger')->debug('Query: ' . ActiveRecord::$conn->lastQuery);
$stmt->close();
return $rs;
}