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


PHP Criteria::setDbName方法代码示例

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


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

示例1: testApplyLimitDuplicateColumnNameWithColumn

 public function testApplyLimitDuplicateColumnNameWithColumn()
 {
     Propel::getServiceContainer()->setAdapter('oracle', new OracleAdapter());
     $c = new Criteria();
     $c->setDbName('oracle');
     BookTableMap::addSelectColumns($c);
     AuthorTableMap::addSelectColumns($c);
     $c->addAsColumn('BOOK_PRICE', BookTableMap::COL_PRICE);
     $c->setLimit(1);
     $params = [];
     $asColumns = $c->getAsColumns();
     $sql = $c->createSelectSql($params);
     $this->assertEquals('SELECT B.* FROM (SELECT A.*, rownum AS PROPEL_ROWNUM FROM (SELECT book.id AS ORA_COL_ALIAS_0, book.title AS ORA_COL_ALIAS_1, book.isbn AS ORA_COL_ALIAS_2, book.price AS ORA_COL_ALIAS_3, book.publisher_id AS ORA_COL_ALIAS_4, book.author_id AS ORA_COL_ALIAS_5, author.id AS ORA_COL_ALIAS_6, author.first_name AS ORA_COL_ALIAS_7, author.last_name AS ORA_COL_ALIAS_8, author.email AS ORA_COL_ALIAS_9, author.age AS ORA_COL_ALIAS_10, book.price AS BOOK_PRICE FROM book, author) A ) B WHERE  B.PROPEL_ROWNUM <= 1', $sql, 'applyLimit() creates a subselect with aliased column names when a duplicate column name is found');
     $this->assertEquals($asColumns, $c->getAsColumns(), 'createSelectSql supplementary add alias column');
 }
开发者ID:disider,项目名称:Propel2,代码行数:15,代码来源:OracleAdapterTest.php

示例2: testApplyLimitDuplicateColumnNameWithColumn

 public function testApplyLimitDuplicateColumnNameWithColumn()
 {
     Propel::getServiceContainer()->setAdapter('oracle', new OracleAdapter());
     $c = new Criteria();
     $c->setDbName('oracle');
     BookTableMap::addSelectColumns($c);
     AuthorTableMap::addSelectColumns($c);
     $c->addAsColumn('BOOK_PRICE', BookTableMap::PRICE);
     $c->setLimit(1);
     $params = array();
     $asColumns = $c->getAsColumns();
     $sql = $c->createSelectSql($params);
     $this->assertEquals('SELECT B.* FROM (SELECT A.*, rownum AS PROPEL_ROWNUM FROM (SELECT book.ID AS ORA_COL_ALIAS_0, book.TITLE AS ORA_COL_ALIAS_1, book.ISBN AS ORA_COL_ALIAS_2, book.PRICE AS ORA_COL_ALIAS_3, book.PUBLISHER_ID AS ORA_COL_ALIAS_4, book.AUTHOR_ID AS ORA_COL_ALIAS_5, author.ID AS ORA_COL_ALIAS_6, author.FIRST_NAME AS ORA_COL_ALIAS_7, author.LAST_NAME AS ORA_COL_ALIAS_8, author.EMAIL AS ORA_COL_ALIAS_9, author.AGE AS ORA_COL_ALIAS_10, book.PRICE AS BOOK_PRICE FROM book, author) A ) B WHERE  B.PROPEL_ROWNUM <= 1', $sql, 'applyLimit() creates a subselect with aliased column names when a duplicate column name is found');
     $this->assertEquals($asColumns, $c->getAsColumns(), 'createSelectSql supplementary add alias column');
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:15,代码来源:OracleAdapterTest.php


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