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


PHP JDatabaseQuery::andWhere方法代码示例

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


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

示例1: testAndWhere

 /**
  * Tests the JDatabaseQuery::andWhere method.
  *
  * @return  void
  *
  * @since   3.6
  */
 public function testAndWhere()
 {
     $this->assertThat($this->_instance->where('foo = 1')->andWhere('bar = 2'), $this->identicalTo($this->_instance), 'Tests chaining.');
     $this->assertThat(trim(TestReflection::getValue($this->_instance, 'where')), $this->equalTo('WHERE ' . PHP_EOL . '(foo = 1) AND ' . PHP_EOL . '(bar = 2)'), 'Tests rendered value.');
     // Add another set of where conditions.
     $this->_instance->andWhere(array('baz = 3', 'goo = 4'));
     $this->assertThat(trim(TestReflection::getValue($this->_instance, 'where')), $this->equalTo('WHERE ' . PHP_EOL . '(' . PHP_EOL . '(foo = 1) AND ' . PHP_EOL . '(bar = 2)) AND ' . PHP_EOL . '(baz = 3 OR goo = 4)'), 'Tests rendered value after second use and array input.');
     // Add another set of where conditions with some different glue.
     $this->_instance->andWhere(array('faz = 5', 'gaz = 6'), 'XOR');
     $this->assertThat(trim(TestReflection::getValue($this->_instance, 'where')), $this->equalTo('WHERE ' . PHP_EOL . '(' . PHP_EOL . '(' . PHP_EOL . '(foo = 1) AND ' . PHP_EOL . '(bar = 2)) AND ' . PHP_EOL . '(baz = 3 OR goo = 4)) AND ' . PHP_EOL . '(faz = 5 XOR gaz = 6)'), 'Tests rendered value after third use, array input and different glue.');
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:18,代码来源:JDatabaseQueryTest.php


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