Commit 10c6bc31 authored by Guilherme Blanco's avatar Guilherme Blanco

Added support for namespace/schema quoting if it is a reserved keyword.

parent aa6be84b
This diff is collapsed.
......@@ -95,6 +95,23 @@ abstract class AbstractAsset
return $this->_namespace;
}
/**
* Gets the quoted representation of this namespace asset but only if it was defined with one.
* Otherwise return the plain unquoted namespace value as inserted.
*
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*
* @return string
*/
public function getQuotedNamespaceName(AbstractPlatform $platform)
{
$keywords = $platform->getReservedKeywordsList();
return ($this->_quoted || $keywords->isKeyword($this->_namespace))
? $platform->quoteIdentifier($this->_namespace)
: $this->_namespace;
}
/**
* The shortest name is stripped of the default namespace. All other
* namespaced elements are returned as full-qualified names.
......
......@@ -105,7 +105,8 @@ class CreateSchemaSqlCollector extends AbstractVisitor
*/
private function getNamespace($asset)
{
$namespace = $asset->getNamespaceName() ?: 'default';
$namespace = $asset->getQuotedNamespaceName($this->platform) ?: 'default';
if ( !isset($this->createTableQueries[$namespace])) {
$this->createTableQueries[$namespace] = array();
$this->createSequenceQueries[$namespace] = array();
......
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