本文整理汇总了PHP中SelectQuery::setSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::setSelect方法的具体用法?PHP SelectQuery::setSelect怎么用?PHP SelectQuery::setSelect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::setSelect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSubqueryWithConditions
/**
* testing nested subquery (query, which uses subquery, which uses subquery) and checking, that conditions are correct (for use in prepared queries)
*/
public function testSubqueryWithConditions()
{
$field1 = new Field('id', 0);
$subq2 = new SelectQuery(array('bans'));
$subq2->setSelect(array($field1));
$subq2->setWhere(new Condition('=', new Field('abc'), 10));
$subq = new SelectQuery(array('users'));
$subq->setSelect(array($field1));
$subq->setWhere(new AndOp(new Condition('>', new Field('age'), 14), new Condition('in', new Field('id'), $subq2), new Condition('=', new Field('regdt'), '2009-01-01')));
$q = new SelectQuery(array('posts'));
$q->setWhere(new AndOp(new Condition('>', new Field('comment'), 1), new Condition('in', new Field('user_id'), $subq), new Condition('=', new Field('funny'), 1)));
$this->assertEquals('SELECT `t0`.* FROM `posts` AS `t0` WHERE (`t0`.`comment` > :p1 AND `t0`.`user_id` IN (SELECT `t0`.`id` FROM `users` AS `t0` WHERE (`t0`.`age` > :p2 AND `t0`.`id` IN (SELECT `t0`.`id` FROM `bans` AS `t0` WHERE `t0`.`abc` = :p3) AND `t0`.`regdt` = :p4)) AND `t0`.`funny` = :p5)', $q->sql());
}