Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
06e64e27
Commit
06e64e27
authored
Jan 12, 2015
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotfix/#736-DBAL-1058-fix-database-and-namespace-introspection-for-sql-server'
Close #736
parents
057c07ba
08f4b2be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+2
-2
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+23
-0
AbstractSQLServerPlatformTestCase.php
...ests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
+1
-1
No files found.
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
06e64e27
...
...
@@ -1028,7 +1028,7 @@ class SQLServerPlatform extends AbstractPlatform
*/
public
function
getListDatabasesSQL
()
{
return
'SELECT * FROM
SYS.DATABASES
'
;
return
'SELECT * FROM
sys.databases
'
;
}
/**
...
...
@@ -1036,7 +1036,7 @@ class SQLServerPlatform extends AbstractPlatform
*/
public
function
getListNamespacesSQL
()
{
return
"SELECT name FROM
SYS.SCHEMAS
WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys')"
;
return
"SELECT name FROM
sys.schemas
WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys')"
;
}
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
06e64e27
...
...
@@ -95,6 +95,29 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this
->
assertContains
(
'test_create_database'
,
$databases
);
}
/**
* @group DBAL-1058
*/
public
function
testListNamespaceNames
()
{
if
(
!
$this
->
_sm
->
getDatabasePlatform
()
->
supportsSchemas
())
{
$this
->
markTestSkipped
(
'Platform does not support schemas.'
);
}
// Currently dropping schemas is not supported, so we have to workaround here.
$namespaces
=
$this
->
_sm
->
listNamespaceNames
();
$namespaces
=
array_map
(
'strtolower'
,
$namespaces
);
if
(
!
in_array
(
'test_create_schema'
,
$namespaces
))
{
$this
->
_conn
->
executeUpdate
(
$this
->
_sm
->
getDatabasePlatform
()
->
getCreateSchemaSQL
(
'test_create_schema'
));
$namespaces
=
$this
->
_sm
->
listNamespaceNames
();
$namespaces
=
array_map
(
'strtolower'
,
$namespaces
);
}
$this
->
assertContains
(
'test_create_schema'
,
$namespaces
);
}
public
function
testListTables
()
{
$this
->
createTestTable
(
'list_tables_test'
);
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
View file @
06e64e27
...
...
@@ -81,7 +81,7 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
{
$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
(
$dropDatabaseExpectation
,
$this
->
_platform
->
getDropDatabaseSQL
(
'foobar'
));
$this
->
assertEquals
(
'DROP TABLE foobar'
,
$this
->
_platform
->
getDropTableSQL
(
'foobar'
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment