Commit 1f34a074 authored by Marco Pivetta's avatar Marco Pivetta

Merge pull request #737 from deeky666/DBAL-1058-2.4

[DBAL-1058] [2.4] Fix database names introspection for SQL Server
parents 5ca7d3ca 9b859218
...@@ -675,7 +675,7 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -675,7 +675,7 @@ class SQLServerPlatform extends AbstractPlatform
*/ */
public function getListDatabasesSQL() public function getListDatabasesSQL()
{ {
return 'SELECT * FROM SYS.DATABASES'; return 'SELECT * FROM sys.databases';
} }
/** /**
...@@ -848,7 +848,7 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -848,7 +848,7 @@ class SQLServerPlatform extends AbstractPlatform
$pattern = sprintf('/%s\.(%s)\s*(AS)?\s*([^,\s\)]*)/i', $column['table'], $column['column']); $pattern = sprintf('/%s\.(%s)\s*(AS)?\s*([^,\s\)]*)/i', $column['table'], $column['column']);
$overColumn = preg_match($pattern, $query, $matches) $overColumn = preg_match($pattern, $query, $matches)
? ($column['hasTable'] ? $column['table'] . '.' : '') . $column['column'] ? ($column['hasTable'] ? $column['table'] . '.' : '') . $column['column']
: $column['column']; : $column['column'];
if (isset($column['sort'])) { if (isset($column['sort'])) {
......
...@@ -84,7 +84,7 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase ...@@ -84,7 +84,7 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
{ {
$dropDatabaseExpectation = 'DROP DATABASE foobar'; $dropDatabaseExpectation = 'DROP DATABASE foobar';
$this->assertEquals('SELECT * FROM SYS.DATABASES', $this->_platform->getListDatabasesSQL()); $this->assertEquals('SELECT * FROM sys.databases', $this->_platform->getListDatabasesSQL());
$this->assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); $this->assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar'));
$this->assertEquals($dropDatabaseExpectation, $this->_platform->getDropDatabaseSQL('foobar')); $this->assertEquals($dropDatabaseExpectation, $this->_platform->getDropDatabaseSQL('foobar'));
$this->assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); $this->assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment