本文整理汇总了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);
}