本文整理匯總了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;
}