mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 06:37:55 +08:00 
			
		
		
		
	Fix #10020: Fixed quoting of column names with dots in MSSQL
This commit is contained in:
		
				
					committed by
					
						
						Alexander Makarov
					
				
			
			
				
	
			
			
			
						parent
						
							8b2f34d72c
						
					
				
				
					commit
					259c496e2e
				
			@ -4,7 +4,7 @@ Yii Framework 2 Change Log
 | 
			
		||||
2.0.24 under development
 | 
			
		||||
------------------------
 | 
			
		||||
 | 
			
		||||
- no changes in this release.
 | 
			
		||||
- Bug #10020: Fixed quoting of column names with dots in MSSQL (alexkart)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
2.0.23 July 16, 2019
 | 
			
		||||
 | 
			
		||||
@ -739,4 +739,16 @@ SQL;
 | 
			
		||||
 | 
			
		||||
        return $result[$returnType];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function quoteColumnName($name)
 | 
			
		||||
    {
 | 
			
		||||
        if (preg_match('/^\[.*\]$/', $name)) {
 | 
			
		||||
            return $name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return parent::quoteColumnName($name);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -63,6 +63,10 @@ class ConnectionTest extends \yiiunit\framework\db\ConnectionTest
 | 
			
		||||
        $this->assertEquals('{{%table}}.[column]', $connection->quoteColumnName('{{%table}}.column'));
 | 
			
		||||
        $this->assertEquals('{{%table}}.[column]', $connection->quoteColumnName('{{%table}}.[column]'));
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals('[column.name]', $connection->quoteColumnName('[column.name]'));
 | 
			
		||||
        $this->assertEquals('[column.name.with.dots]', $connection->quoteColumnName('[column.name.with.dots]'));
 | 
			
		||||
        $this->assertEquals('[table].[column.name.with.dots]', $connection->quoteColumnName('[table].[column.name.with.dots]'));
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals('[table].[column]', $connection->quoteSql('[[table.column]]'));
 | 
			
		||||
        $this->assertEquals('[table].[column]', $connection->quoteSql('{{table}}.[[column]]'));
 | 
			
		||||
        $this->assertEquals('[table].[column]', $connection->quoteSql('{{table}}.[column]'));
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user