本文整理汇总了PHP中aql::sql方法的典型用法代码示例。如果您正苦于以下问题:PHP aql::sql方法的具体用法?PHP aql::sql怎么用?PHP aql::sql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aql
的用法示例。
在下文中一共展示了aql::sql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
function select($aql = null, $clause = null)
{
if ($aql) {
$this->aql = $aql;
}
if ($clause) {
$this->clause = $clause;
}
//pagination settings
$default_limit = if_not($this->clause['default_limit'], 25);
if (!$_GET['limit' . $this->i]) {
$_GET['limit' . $this->i] = $default_limit;
}
$this->offset = $_GET['page' . $this->i] * $_GET['limit' . $this->i] - $_GET['limit' . $this->i];
$this->clause['limit'] = $_GET['limit' . $this->i];
$this->clause['offset'] = $this->offset;
$this->rs = aql::select($this->aql, $this->clause);
$this->first_row = $this->offset + 1;
$this->last_row = count($this->rs) + $this->first_row - 1;
$c = aql::sql($this->aql, $this->clause);
$c = sql($c['sql_count']);
$this->total_rows = $c->Fields('count');
$this->num_pages = ceil($this->total_rows / $_GET['limit' . $this->i]);
return $this->rs;
}
示例2: makeQueries
/**
* Generates the sql queries
* This is the last step before execution
* @return $this
*/
public function makeQueries()
{
$sql = aql::sql($this->aql, array('limit' => $this->limit, 'where' => $this->where, 'order by' => $this->order_by, 'offset' => $this->offset));
$this->count_sql = preg_replace('/\\bcount\\(\\*\\)/', "count(distinct {$sql['primary_table']}.id)", $sql['sql_count']);
$this->query_sql = $sql['sql_list'];
return $this;
}