Changeset 4708

Show
Ignore:
Timestamp:
07/24/08 01:13:07 (4 months ago)
Author:
guilhermeblanco
Message:

fixes #1262 and fixes #1272

Location:
branches
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Query.php

    r4686 r4708  
    15451545                    $assocPath = $prevPath . '.' . $asf->getComponentName(); 
    15461546 
    1547                     $this->_queryComponents[$assocPath] = array('parent' => $prevPath, 'relation' => $relation, 'table' => $asf); 
     1547                    $this->_queryComponents[$assocPath] = array( 
     1548                        'parent' => $prevPath,  
     1549                        'relation' => $relation, 
     1550                        'table' => $asf 
     1551                    ); 
    15481552 
    15491553                    $assocAlias = $this->getTableAlias($assocPath, $asf->getTableName()); 
    15501554 
    1551                     $queryPart = $join . $assocTableName . ' ' . $assocAlias; 
    1552  
    1553                     $queryPart .= ' ON ' . $localAlias 
    1554                                 . '.' 
    1555                                 . $localTable->getColumnName($localTable->getIdentifier()) // what about composite keys? 
     1555                    $queryPart = $join . $this->_conn->quoteIdentifier($assocTableName)  
     1556                               . ' ' . $this->_conn->quoteIdentifier($assocAlias); 
     1557 
     1558                    $queryPart .= ' ON '  
     1559                                . $this->_conn->quoteIdentifier($localAlias . '.' 
     1560                                // what about composite keys? 
     1561                                . $localTable->getColumnName($localTable->getIdentifier())) 
    15561562                                . ' = ' 
    1557                                 . $assocAlias . '.' . $relation->getLocal(); 
     1563                                . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()); 
    15581564 
    15591565                    if ($relation->isEqual()) { 
    15601566                        // equal nest relation needs additional condition 
    1561                         $queryPart .= ' OR ' . $localAlias 
    1562                                     . '.' 
    1563                                     . $table->getColumnName($table->getIdentifier()) 
     1567                        $queryPart .= ' OR '  
     1568                                    . $this->_conn->quoteIdentifier($localAlias . '.' 
     1569                                    . $table->getColumnName($table->getIdentifier())) 
    15641570                                    . ' = ' 
    1565                                     . $assocAlias . '.' . $relation->getForeign(); 
     1571                                    . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign()); 
    15661572                    } 
    15671573 
  • branches/0.11/lib/Doctrine/Query/JoinCondition.php

    r4560 r4708  
    140140                default: 
    141141                    $leftExpr = (($hasLeftAggExpression) ? $leftMatches[1] . '(' : '')  
    142                               . $alias . '.' . $field 
     142                              . $conn->quoteIdentifier($alias . '.' . $field) 
    143143                              . (($hasLeftAggExpression) ? $leftMatches[3] . ')' : '') ; 
    144144 
  • branches/1.0/lib/Doctrine/Query.php

    r4686 r4708  
    15451545                    $assocPath = $prevPath . '.' . $asf->getComponentName(); 
    15461546 
    1547                     $this->_queryComponents[$assocPath] = array('parent' => $prevPath, 'relation' => $relation, 'table' => $asf); 
     1547                    $this->_queryComponents[$assocPath] = array( 
     1548                        'parent' => $prevPath,  
     1549                        'relation' => $relation, 
     1550                        'table' => $asf 
     1551                    ); 
    15481552 
    15491553                    $assocAlias = $this->getTableAlias($assocPath, $asf->getTableName()); 
    15501554 
    1551                     $queryPart = $join . $assocTableName . ' ' . $assocAlias; 
    1552  
    1553                     $queryPart .= ' ON ' . $localAlias 
    1554                                 . '.' 
    1555                                 . $localTable->getColumnName($localTable->getIdentifier()) // what about composite keys? 
     1555                    $queryPart = $join . $this->_conn->quoteIdentifier($assocTableName)  
     1556                               . ' ' . $this->_conn->quoteIdentifier($assocAlias); 
     1557 
     1558                    $queryPart .= ' ON ' 
     1559                                . $this->_conn->quoteIdentifier($localAlias . '.' 
     1560                                // what about composite keys? 
     1561                                . $localTable->getColumnName($localTable->getIdentifier())) 
    15561562                                . ' = ' 
    1557                                 . $assocAlias . '.' . $relation->getLocal(); 
     1563                                . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()); 
    15581564 
    15591565                    if ($relation->isEqual()) { 
    15601566                        // equal nest relation needs additional condition 
    1561                         $queryPart .= ' OR ' . $localAlias 
    1562                                     . '.' 
    1563                                     . $table->getColumnName($table->getIdentifier()) 
     1567                        $queryPart .= ' OR ' 
     1568                                    . $this->_conn->quoteIdentifier($localAlias . '.' 
     1569                                    . $table->getColumnName($table->getIdentifier())) 
    15641570                                    . ' = ' 
    1565                                     . $assocAlias . '.' . $relation->getForeign(); 
     1571                                    . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign()); 
    15661572                    } 
    15671573 
  • branches/1.0/lib/Doctrine/Query/JoinCondition.php

    r4560 r4708  
    140140                default: 
    141141                    $leftExpr = (($hasLeftAggExpression) ? $leftMatches[1] . '(' : '')  
    142                               . $alias . '.' . $field 
     142                              . $conn->quoteIdentifier($alias . '.' . $field) 
    143143                              . (($hasLeftAggExpression) ? $leftMatches[3] . ')' : '') ; 
    144144