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


PHP Propel::setDb方法代码示例

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


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

示例1: testCreateSelectSqlPart

 public function testCreateSelectSqlPart()
 {
     Propel::setDb('oracle', new DBOracle());
     $db = Propel::getDB();
     $c = new Criteria();
     $c->addSelectColumn(BookPeer::ID);
     $c->addAsColumn('book_ID', BookPeer::ID);
     $fromClause = array();
     $selectSql = $db->createSelectSqlPart($c, $fromClause);
     $this->assertEquals('SELECT book.ID, book.ID AS book_ID', $selectSql, 'createSelectSqlPart() returns a SQL SELECT clause with both select and as columns');
     $this->assertEquals(array('book'), $fromClause, 'createSelectSqlPart() adds the tables from the select columns to the from clause');
 }
开发者ID:shelsonjava,项目名称:datawrapper,代码行数:12,代码来源:DBOracleTest.php

示例2: testApplyLimitDuplicateColumnName

 public function testApplyLimitDuplicateColumnName()
 {
     Propel::setDb('oracle', new DBOracle());
     $c = new Criteria();
     $c->setDbName('oracle');
     BookPeer::addSelectColumns($c);
     AuthorPeer::addSelectColumns($c);
     $c->setLimit(1);
     $params = array();
     $sql = BasePeer::createSelectSql($c, $params);
     $this->assertEquals('SELECT B.* FROM (SELECT A.*, rownum AS PROPEL_ROWNUM FROM (SELECT book.ID AS book_ID, book.TITLE AS book_TITLE, book.ISBN AS book_ISBN, book.PRICE AS book_PRICE, book.PUBLISHER_ID AS book_PUBLISHER_ID, book.AUTHOR_ID AS book_AUTHOR_ID, author.ID AS author_ID, author.FIRST_NAME AS author_FIRST_NAME, author.LAST_NAME AS author_LAST_NAME, author.EMAIL AS author_EMAIL, author.AGE AS author_AGESELECT book.ID, book.TITLE, book.ISBN, book.PRICE, book.PUBLISHER_ID, book.AUTHOR_ID, author.ID, author.FIRST_NAME, author.LAST_NAME, author.EMAIL, author.AGE 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');
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:12,代码来源:DBOracleTest.php


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