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


PHP Criteria::addHaving方法代码示例

本文整理汇总了PHP中Propel\Runtime\ActiveQuery\Criteria::addHaving方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::addHaving方法的具体用法?PHP Criteria::addHaving怎么用?PHP Criteria::addHaving使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Propel\Runtime\ActiveQuery\Criteria的用法示例。


在下文中一共展示了Criteria::addHaving方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testHavingRaw

 public function testHavingRaw()
 {
     $c = new Criteria();
     $c->addSelectColumn(BookTableMap::TITLE);
     $c->addAsColumn("isb_n", BookTableMap::ISBN);
     $c->addHaving('isb_n = ?', '1234567890123', \PDO::PARAM_STR);
     $expected = 'SELECT book.TITLE, book.ISBN AS isb_n FROM book HAVING isb_n = :p1';
     $params = array();
     $result = $c->createSelectSql($params);
     $this->assertEquals($expected, $result);
     $c->doSelect($this->con);
     $expected = 'SELECT book.TITLE, book.ISBN AS isb_n FROM book HAVING isb_n = \'1234567890123\'';
     $this->assertEquals($expected, $this->con->getLastExecutedQuery());
 }
开发者ID:robin850,项目名称:Propel2,代码行数:14,代码来源:CriteriaTest.php

示例2: testMergeWithHavingConditions

 public function testMergeWithHavingConditions()
 {
     $c1 = new Criteria();
     $cton = $c1->getNewCriterion(BookTableMap::COL_TITLE, 'foo', Criteria::EQUAL);
     $c1->addHaving($cton);
     $c2 = new Criteria();
     $c1->mergeWith($c2);
     $sql = 'SELECT  FROM  HAVING book.TITLE=:p1';
     $this->assertCriteriaTranslation($c1, $sql, 'mergeWith() does not remove an existing having condition');
     $c1 = new Criteria();
     $c2 = new Criteria();
     $cton = $c2->getNewCriterion(BookTableMap::COL_TITLE, 'foo', Criteria::EQUAL);
     $c2->addHaving($cton);
     $c1->mergeWith($c2);
     $sql = 'SELECT  FROM  HAVING book.TITLE=:p1';
     $this->assertCriteriaTranslation($c1, $sql, 'mergeWith() merges having condition to an empty having');
     $c1 = new Criteria();
     $cton = $c1->getNewCriterion(BookTableMap::COL_TITLE, 'foo', Criteria::EQUAL);
     $c1->addHaving($cton);
     $c2 = new Criteria();
     $cton = $c2->getNewCriterion(BookTableMap::COL_TITLE, 'bar', Criteria::EQUAL);
     $c2->addHaving($cton);
     $c1->mergeWith($c2);
     $sql = 'SELECT  FROM  HAVING (book.TITLE=:p1 AND book.TITLE=:p2)';
     $this->assertCriteriaTranslation($c1, $sql, 'mergeWith() combines having with AND');
 }
开发者ID:bondarovich,项目名称:Propel2,代码行数:26,代码来源:CriteriaMergeTest.php


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