本文整理匯總了PHP中Q::arAnd_block方法的典型用法代碼示例。如果您正苦於以下問題:PHP Q::arAnd_block方法的具體用法?PHP Q::arAnd_block怎麽用?PHP Q::arAnd_block使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Q
的用法示例。
在下文中一共展示了Q::arAnd_block方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: find
/**
* 検索を実行する
*
* @return StatementIterator
*/
public final function find()
{
$this->verify_class_access("call C(DAO_CLASS)->find()");
$args = func_get_args();
$query = new Q();
call_user_func_array(array($query, "add"), $args);
if (!$query->isOrder_by()) {
foreach ($this->primary_columns() as $column) {
$query->order($column->name());
}
}
$paginator = $query->paginator();
if ($paginator instanceof Paginator) {
$paginator->total(call_user_func_array(array($this, "find_count"), $query->arAnd_block()));
}
$sql = $this->call_module("select_sql", $this, $query, $paginator);
$statement = $this->prepare($sql->sql);
$statement->execute($sql->vars);
$errors = $statement->errorInfo();
if (sizeof($errors) == 3) {
throw new LogicException("[" . $errors[1] . "] " . $errors[2]);
}
return new StatementIterator($this, $statement);
}
示例2: where_sql
protected function where_sql(Dao $dao, Q $q, array $self_columns, $require_where = null)
{
if ($q->isBlock()) {
$vars = $and = array();
foreach ($q->arAnd_block() as $qa) {
list($where, $var) = $this->where_sql($dao, $qa, $self_columns);
if (!empty($where)) {
$and[] = $where;
$vars = array_merge($vars, $var);
}
}
$where_sql = empty($and) ? "" : "(" . implode(" and ", $and) . ") ";
foreach ($q->arOr_block() as $or_block) {
foreach ($or_block as $qa) {
list($where, $var) = $this->where_sql($dao, $qa, $self_columns);
if (!empty($where)) {
$where_sql .= " or (" . $where . ") ";
$vars = array_merge($vars, $var);
}
}
}
if (empty($where_sql)) {
$where_sql = $require_where;
} else {
if (!empty($require_where)) {
$where_sql = "(" . $require_where . ") and (" . $where_sql . ")";
}
}
return array($where_sql, $vars);
}
if ($q->type() == Q::MATCH) {
return $this->where_sql($dao, $this->where_match($q, $self_columns), $self_columns);
}
return $this->where_cond($dao, $q, $self_columns);
}