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


PHP AbstractPlatform::getSqlResultCasing方法代码示例

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


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

示例1: _getSelectColumnList

 /**
  * Gets the SQL fragment with the list of columns to select when querying for
  * a entity of the type of this persister.
  * 
  * @return string The SQL fragment.
  */
 protected function _getSelectColumnList()
 {
     $columnList = '';
     $tableName = $this->_class->getQuotedTableName($this->_platform);
     $setResultColumnNames = empty($this->_resultColumnNames);
     // Add regular columns to select list
     foreach ($this->_class->fieldNames as $field) {
         if ($columnList != '') {
             $columnList .= ', ';
         }
         $columnList .= $tableName . '.' . $this->_class->getQuotedColumnName($field, $this->_platform);
         if ($setResultColumnNames) {
             $resultColumnName = $this->_platform->getSqlResultCasing($this->_class->columnNames[$field]);
             $this->_resultColumnNames[$resultColumnName] = $this->_class->columnNames[$field];
         }
     }
     // Add join columns (foreign keys) to select list
     foreach ($this->_class->associationMappings as $assoc) {
         if ($assoc->isOwningSide && $assoc->isOneToOne()) {
             foreach ($assoc->targetToSourceKeyColumns as $srcColumn) {
                 $columnList .= ', ' . $assoc->getQuotedJoinColumnName($srcColumn, $this->_platform);
                 if ($setResultColumnNames) {
                     $resultColumnName = $this->_platform->getSqlResultCasing($srcColumn);
                     $this->_resultColumnNames[$resultColumnName] = $srcColumn;
                 }
             }
         }
     }
     return $columnList;
 }
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:36,代码来源:StandardEntityPersister.php

示例2: walkSelectExpression

 /**
  * Walks down a SelectExpression AST node and generates the corresponding SQL.
  *
  * @param SelectExpression $selectExpression
  * @return string The SQL.
  */
 public function walkSelectExpression($selectExpression)
 {
     $sql = '';
     $expr = $selectExpression->expression;
     if ($expr instanceof AST\PathExpression) {
         if ($expr->type == AST\PathExpression::TYPE_STATE_FIELD) {
             $parts = $expr->parts;
             $fieldName = array_pop($parts);
             $dqlAlias = $expr->identificationVariable . (!empty($parts) ? '.' . implode('.', $parts) : '');
             $qComp = $this->_queryComponents[$dqlAlias];
             $class = $qComp['metadata'];
             if (!isset($this->_selectedClasses[$dqlAlias])) {
                 $this->_selectedClasses[$dqlAlias] = $class;
             }
             $sqlTableAlias = $this->getSqlTableAlias($class->getTableName(), $dqlAlias);
             $columnName = $class->getQuotedColumnName($fieldName, $this->_platform);
             $columnAlias = $this->getSqlColumnAlias($class->columnNames[$fieldName]);
             $sql .= $sqlTableAlias . '.' . $columnName . ' AS ' . $columnAlias;
             $columnAlias = $this->_platform->getSqlResultCasing($columnAlias);
             $this->_rsm->addFieldResult($dqlAlias, $columnAlias, $fieldName, $class->name);
         } else {
             throw DoctrineException::invalidPathExpression($expr->type);
         }
     } else {
         if ($expr instanceof AST\AggregateExpression) {
             if (!$selectExpression->fieldIdentificationVariable) {
                 $resultAlias = $this->_scalarResultCounter++;
             } else {
                 $resultAlias = $selectExpression->fieldIdentificationVariable;
             }
             $columnAlias = 'sclr' . $this->_aliasCounter++;
             $sql .= $this->walkAggregateExpression($expr) . ' AS ' . $columnAlias;
             $this->_scalarResultAliasMap[$resultAlias] = $columnAlias;
             $columnAlias = $this->_platform->getSqlResultCasing($columnAlias);
             $this->_rsm->addScalarResult($columnAlias, $resultAlias);
         } else {
             if ($expr instanceof AST\Subselect) {
                 $sql .= $this->walkSubselect($expr);
             } else {
                 if ($expr instanceof AST\Functions\FunctionNode) {
                     if (!$selectExpression->fieldIdentificationVariable) {
                         $resultAlias = $this->_scalarResultCounter++;
                     } else {
                         $resultAlias = $selectExpression->fieldIdentificationVariable;
                     }
                     $columnAlias = 'sclr' . $this->_aliasCounter++;
                     $sql .= $this->walkFunction($expr) . ' AS ' . $columnAlias;
                     $this->_scalarResultAliasMap[$resultAlias] = $columnAlias;
                     $columnAlias = $this->_platform->getSqlResultCasing($columnAlias);
                     $this->_rsm->addScalarResult($columnAlias, $resultAlias);
                 } else {
                     // $expr == IdentificationVariable
                     $dqlAlias = $expr;
                     $queryComp = $this->_queryComponents[$dqlAlias];
                     $class = $queryComp['metadata'];
                     if (!isset($this->_selectedClasses[$dqlAlias])) {
                         $this->_selectedClasses[$dqlAlias] = $class;
                     }
                     $beginning = true;
                     // Select all fields from the queried class
                     foreach ($class->fieldMappings as $fieldName => $mapping) {
                         if (isset($mapping['inherited'])) {
                             $tableName = $this->_em->getClassMetadata($mapping['inherited'])->primaryTable['name'];
                         } else {
                             $tableName = $class->primaryTable['name'];
                         }
                         if ($beginning) {
                             $beginning = false;
                         } else {
                             $sql .= ', ';
                         }
                         $sqlTableAlias = $this->getSqlTableAlias($tableName, $dqlAlias);
                         $columnAlias = $this->getSqlColumnAlias($mapping['columnName']);
                         $sql .= $sqlTableAlias . '.' . $class->getQuotedColumnName($fieldName, $this->_platform) . ' AS ' . $columnAlias;
                         $columnAlias = $this->_platform->getSqlResultCasing($columnAlias);
                         $this->_rsm->addFieldResult($dqlAlias, $columnAlias, $fieldName, $class->name);
                     }
                     // Add any additional fields of subclasses (excluding inherited fields)
                     // 1) on Single Table Inheritance: always, since its marginal overhead
                     // 2) on Class Table Inheritance only if partial objects are disallowed,
                     //    since it requires outer joining subtables.
                     if ($class->isInheritanceTypeSingleTable() || !$this->_query->getHint(Query::HINT_FORCE_PARTIAL_LOAD)) {
                         foreach ($class->subClasses as $subClassName) {
                             $subClass = $this->_em->getClassMetadata($subClassName);
                             $sqlTableAlias = $this->getSqlTableAlias($subClass->primaryTable['name'], $dqlAlias);
                             foreach ($subClass->fieldMappings as $fieldName => $mapping) {
                                 if (isset($mapping['inherited'])) {
                                     continue;
                                 }
                                 if ($beginning) {
                                     $beginning = false;
                                 } else {
                                     $sql .= ', ';
                                 }
//.........这里部分代码省略.........
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:101,代码来源:SqlWalker.php


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