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


PHP BasePeer::turnSelectColumnsToAliases方法代码示例

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


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

示例1: getCountStatement

 protected function getCountStatement($con = null)
 {
     $dbMap = Propel::getDatabaseMap($this->getDbName());
     $db = Propel::getDB($this->getDbName());
     if ($con === null) {
         $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
     }
     // check that the columns of the main class are already added (if this is the primary ModelCriteria)
     if (!$this->hasSelectClause() && !$this->getPrimaryCriteria()) {
         $this->addSelfSelectColumns();
     }
     $needsComplexCount = $this->getGroupByColumns() || $this->getOffset() || $this->getLimit() || $this->getHaving() || in_array(Criteria::DISTINCT, $this->getSelectModifiers());
     $con->beginTransaction();
     try {
         $this->basePreSelect($con);
         $params = array();
         if ($needsComplexCount) {
             if (BasePeer::needsSelectAliases($this)) {
                 if ($this->getHaving()) {
                     throw new PropelException('Propel cannot create a COUNT query when using HAVING and  duplicate column names in the SELECT part');
                 }
                 BasePeer::turnSelectColumnsToAliases($this);
             }
             $selectSql = BasePeer::createSelectSql($this, $params);
             $sql = 'SELECT COUNT(*) FROM (' . $selectSql . ') propelmatch4cnt';
         } else {
             // Replace SELECT columns with COUNT(*)
             $this->clearSelectColumns()->addSelectColumn('COUNT(*)');
             $sql = BasePeer::createSelectSql($this, $params);
         }
         $stmt = $con->prepare($sql);
         BasePeer::populateStmtValues($stmt, $params, $dbMap, $db);
         $stmt->execute();
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
     return $stmt;
 }
开发者ID:sanemat,项目名称:bllik,代码行数:40,代码来源:ModelCriteria.php

示例2: testTurnSelectColumnsToAliasesDuplicate

 public function testTurnSelectColumnsToAliasesDuplicate()
 {
     $c1 = new Criteria();
     $c1->addSelectColumn(BookPeer::ID);
     $c1->addSelectColumn(BookPeer::ID);
     BasePeer::turnSelectColumnsToAliases($c1);
     $c2 = new Criteria();
     $c2->addAsColumn('book_ID', BookPeer::ID);
     $c2->addAsColumn('book_ID_1', BookPeer::ID);
     $this->assertTrue($c1->equals($c2));
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:11,代码来源:BasePeerTest.php


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