本文整理汇总了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;
}
示例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 .= ', ';
}
//.........这里部分代码省略.........