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
faeab05b
Commit
faeab05b
authored
Apr 02, 2014
by
Steve Müller
Committed by
Marco Pivetta
Aug 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ability to introspect namespace names on capable platforms
parent
45664da5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
0 deletions
+88
-0
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+12
-0
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+8
-0
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+8
-0
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+44
-0
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+8
-0
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+8
-0
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
faeab05b
...
...
@@ -2678,6 +2678,18 @@ abstract class AbstractPlatform
throw
DBALException
::
notSupported
(
__METHOD__
);
}
/**
* Returns the SQL statement for retrieving the namespaces defined in the database.
*
* @return string
*
* @throws \Doctrine\DBAL\DBALException If not supported on this platform.
*/
public
function
getListNamespacesSQL
()
{
throw
DBALException
::
notSupported
(
__METHOD__
);
}
/**
* @param string $database
*
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
faeab05b
...
...
@@ -222,6 +222,14 @@ class PostgreSqlPlatform extends AbstractPlatform
return
'SELECT datname FROM pg_database'
;
}
/**
* {@inheritDoc}
*/
public
function
getListNamespacesSQL
()
{
return
"SELECT nspname FROM pg_namespace WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema'"
;
}
/**
* {@inheritDoc}
*/
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
faeab05b
...
...
@@ -1025,6 +1025,14 @@ class SQLServerPlatform extends AbstractPlatform
return
'SELECT * FROM SYS.DATABASES'
;
}
/**
* {@inheritDoc}
*/
public
function
getListNamespacesSQL
()
{
return
"SELECT name FROM SYS.SCHEMAS WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys')"
;
}
/**
* {@inheritDoc}
*/
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
faeab05b
...
...
@@ -115,6 +115,20 @@ abstract class AbstractSchemaManager
return
$this
->
_getPortableDatabasesList
(
$databases
);
}
/**
* Returns a list of all namespaces in the current database.
*
* @return array
*/
public
function
listNamespaceNames
()
{
$sql
=
$this
->
_platform
->
getListNamespacesSQL
();
$namespaces
=
$this
->
_conn
->
fetchAll
(
$sql
);
return
$this
->
getPortableNamespacesList
(
$namespaces
);
}
/**
* Lists the available sequences for this connection.
*
...
...
@@ -651,6 +665,24 @@ abstract class AbstractSchemaManager
return
$list
;
}
/**
* Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.
*
* @param array $namespaces The list of namespace names in the native DBMS data definition.
*
* @return array
*/
protected
function
getPortableNamespacesList
(
array
$namespaces
)
{
$namespacesList
=
array
();
foreach
(
$namespaces
as
$namespace
)
{
$namespacesList
[]
=
$this
->
getPortableNamespaceDefinition
(
$namespace
);
}
return
$namespacesList
;
}
/**
* @param array $database
*
...
...
@@ -661,6 +693,18 @@ abstract class AbstractSchemaManager
return
$database
;
}
/**
* Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.
*
* @param array $namespace The native DBMS namespace definition.
*
* @return mixed
*/
protected
function
getPortableNamespaceDefinition
(
array
$namespace
)
{
return
$namespace
;
}
/**
* @param array $functions
*
...
...
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
faeab05b
...
...
@@ -283,6 +283,14 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
return
$list
;
}
/**
* {@inheritdoc}
*/
protected
function
getPortableNamespaceDefinition
(
array
$namespace
)
{
return
$namespace
[
'nspname'
];
}
/**
* {@inheritdoc}
*/
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
faeab05b
...
...
@@ -180,6 +180,14 @@ class SQLServerSchemaManager extends AbstractSchemaManager
return
$database
[
'name'
];
}
/**
* {@inheritdoc}
*/
protected
function
getPortableNamespaceDefinition
(
array
$namespace
)
{
return
$namespace
[
'name'
];
}
/**
* {@inheritdoc}
*/
...
...
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