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


PHP Criteria::setIgnoreCase方法代码示例

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


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

示例1: testOrderByIgnoreCase

 public function testOrderByIgnoreCase()
 {
     $originalDB = Propel::getServiceContainer()->getAdapter();
     Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), new MysqlAdapter());
     $criteria = new Criteria();
     $criteria->setIgnoreCase(true);
     $criteria->addAscendingOrderByColumn(BookTableMap::TITLE);
     BookTableMap::addSelectColumns($criteria);
     $params = array();
     $sql = $criteria->createSelectSql($params);
     $expectedSQL = 'SELECT book.ID, book.TITLE, book.ISBN, book.PRICE, book.PUBLISHER_ID, book.AUTHOR_ID, UPPER(book.TITLE) FROM `book` ORDER BY UPPER(book.TITLE) ASC';
     $this->assertEquals($expectedSQL, $sql);
     Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), $originalDB);
 }
开发者ID:robin850,项目名称:Propel2,代码行数:14,代码来源:CriteriaTest.php

示例2: testBigIntIgnoreCaseOrderBy

 public function testBigIntIgnoreCaseOrderBy()
 {
     BookstoreTableMap::doDeleteAll();
     // Some sample data
     $b = new Bookstore();
     $b->setStoreName("SortTest1")->setPopulationServed(2000)->save();
     $b = new Bookstore();
     $b->setStoreName("SortTest2")->setPopulationServed(201)->save();
     $b = new Bookstore();
     $b->setStoreName("SortTest3")->setPopulationServed(302)->save();
     $b = new Bookstore();
     $b->setStoreName("SortTest4")->setPopulationServed(10000000)->save();
     $c = new Criteria();
     $c->setIgnoreCase(true);
     $c->add(BookstoreTableMap::COL_STORE_NAME, 'SortTest%', Criteria::LIKE);
     $c->addAscendingOrderByColumn(BookstoreTableMap::COL_POPULATION_SERVED);
     $rows = BookstoreQuery::create(null, $c)->find();
     $this->assertEquals('SortTest2', $rows[0]->getStoreName());
     $this->assertEquals('SortTest3', $rows[1]->getStoreName());
     $this->assertEquals('SortTest1', $rows[2]->getStoreName());
     $this->assertEquals('SortTest4', $rows[3]->getStoreName());
 }
开发者ID:bondarovich,项目名称:Propel2,代码行数:22,代码来源:TableMapTest.php

示例3: testOrderByIgnoreCase

 public function testOrderByIgnoreCase()
 {
     $originalDB = Propel::getServiceContainer()->getAdapter();
     Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), new MysqlAdapter());
     Propel::getServiceContainer()->setDefaultDatasource('bookstore');
     $criteria = new Criteria();
     $criteria->setIgnoreCase(true);
     $criteria->addAscendingOrderByColumn(BookTableMap::COL_TITLE);
     BookTableMap::addSelectColumns($criteria);
     $params = [];
     $sql = $criteria->createSelectSql($params);
     $expectedSQL = 'SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id, UPPER(book.title) FROM book ORDER BY UPPER(book.title) ASC';
     $this->assertEquals($expectedSQL, $sql);
     Propel::getServiceContainer()->setAdapter(Propel::getServiceContainer()->getDefaultDatasource(), $originalDB);
 }
开发者ID:naldz,项目名称:cyberden,代码行数:15,代码来源:CriteriaTest.php


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