当前位置: 首页>>代码示例>>PHP>>正文


PHP SelectQuery::setSelect方法代码示例

本文整理汇总了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());
 }
开发者ID:NinjaKC,项目名称:MySQL-Query-Builder,代码行数:16,代码来源:SelectQueryTest.php


注:本文中的SelectQuery::setSelect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。