當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。