本文整理汇总了PHP中QueryBuilder::compile方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::compile方法的具体用法?PHP QueryBuilder::compile怎么用?PHP QueryBuilder::compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::compile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testClauses
public function testClauses()
{
$arguments = array();
$arguments[] = 'all';
$arguments[] = array('condition' => 'state=?', 'columns' => 'name', 'order by' => 'last_login asc');
$query = new QueryBuilder('author', $arguments);
$this->assertEqual('select name from authors where state=? order by last_login asc', $query->compile()->getQueryString());
}
示例2: 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;
}
示例3: 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;
}