mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
Fixes #17057: Fixed issues with table names that contain special characters or keywords in MSSQL
This commit is contained in:
committed by
Alexander Makarov
parent
fc29f5f843
commit
eb65dba796
@ -82,4 +82,29 @@ class SchemaTest extends \yiiunit\framework\db\SchemaTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider quoteTableNameDataProvider
|
||||
* @param $name
|
||||
* @param $expectedName
|
||||
* @throws \yii\base\NotSupportedException
|
||||
*/
|
||||
public function testQuoteTableName($name, $expectedName)
|
||||
{
|
||||
$schema = $this->getConnection()->getSchema();
|
||||
$quotedName = $schema->quoteTableName($name);
|
||||
$this->assertEquals($expectedName, $quotedName);
|
||||
}
|
||||
|
||||
public function quoteTableNameDataProvider()
|
||||
{
|
||||
return [
|
||||
['test', '`test`'],
|
||||
['test.test', '`test`.`test`'],
|
||||
['test.test.test', '`test`.`test`.`test`'],
|
||||
['`test`', '`test`'],
|
||||
['`test`.`test`', '`test`.`test`'],
|
||||
['test.`test`.test', '`test`.`test`.`test`'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user