本文整理汇总了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');
}
示例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');
}