Commit f3756f8d authored by Guilherme Blanco's avatar Guilherme Blanco

Merge pull request #357 from doctrine/PgSqlSchemaFix

Added support for namespace/schema quoting if it is a reserved keyword.
parents aa6be84b 10c6bc31
......@@ -7,16 +7,16 @@
"packages": [
{
"name": "doctrine/annotations",
"version": "v1.1.1",
"version": "v1.1.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "v1.1.1"
"reference": "v1.1.2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/v1.1.1",
"reference": "v1.1.1",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/v1.1.2",
"reference": "v1.1.2",
"shasum": ""
},
"require": {
......@@ -63,7 +63,7 @@
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"homepage": "http://jmsyst.com",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
......@@ -74,7 +74,7 @@
"docblock",
"parser"
],
"time": "2013-04-20 08:30:17"
"time": "2013-06-16 21:33:03"
},
{
"name": "doctrine/cache",
......@@ -191,7 +191,7 @@
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"homepage": "http://jmsyst.com",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
......@@ -206,16 +206,16 @@
},
{
"name": "doctrine/common",
"version": "2.4.0-RC2",
"version": "2.4.0-RC4",
"source": {
"type": "git",
"url": "https://github.com/doctrine/common.git",
"reference": "2.4.0-RC2"
"reference": "2.4.0-RC4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/common/zipball/2.4.0-RC2",
"reference": "2.4.0-RC2",
"url": "https://api.github.com/repos/doctrine/common/zipball/2.4.0-RC4",
"reference": "2.4.0-RC4",
"shasum": ""
},
"require": {
......@@ -263,7 +263,7 @@
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"homepage": "http://jmsyst.com",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
......@@ -276,7 +276,7 @@
"persistence",
"spl"
],
"time": "2013-05-09 21:35:24"
"time": "2013-06-21 12:11:28"
},
{
"name": "doctrine/inflector",
......@@ -397,16 +397,16 @@
"packages-dev": [
{
"name": "phpunit/php-code-coverage",
"version": "1.2.9",
"version": "1.2.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "1.2.9"
"reference": "1.2.12"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.9",
"reference": "1.2.9",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.12",
"reference": "1.2.12",
"shasum": ""
},
"require": {
......@@ -415,11 +415,19 @@
"phpunit/php-text-template": ">=1.1.1@stable",
"phpunit/php-token-stream": ">=1.1.3@stable"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@dev"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
......@@ -446,7 +454,7 @@
"testing",
"xunit"
],
"time": "2013-02-26 18:55:56"
"time": "2013-07-06 06:26:16"
},
{
"name": "phpunit/php-file-iterator",
......@@ -539,16 +547,16 @@
},
{
"name": "phpunit/php-timer",
"version": "1.0.4",
"version": "1.0.5",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-timer.git",
"reference": "1.0.4"
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "1.0.5"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-timer/zipball/1.0.4",
"reference": "1.0.4",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1.0.5",
"reference": "1.0.5",
"shasum": ""
},
"require": {
......@@ -575,24 +583,24 @@
}
],
"description": "Utility class for timing",
"homepage": "http://www.phpunit.de/",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2012-10-11 04:45:58"
"time": "2013-08-02 07:42:54"
},
{
"name": "phpunit/php-token-stream",
"version": "1.1.5",
"version": "1.2.0",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-token-stream.git",
"reference": "1.1.5"
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "1.2.0"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-token-stream/zipball/1.1.5",
"reference": "1.1.5",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1.2.0",
"reference": "1.2.0",
"shasum": ""
},
"require": {
......@@ -600,6 +608,11 @@
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
......@@ -620,24 +633,24 @@
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "http://www.phpunit.de/",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2012-10-11 04:47:14"
"time": "2013-08-04 05:57:48"
},
{
"name": "phpunit/phpunit",
"version": "3.7.19",
"version": "3.7.23",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3.7.19"
"reference": "3.7.23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.19",
"reference": "3.7.19",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.23",
"reference": "3.7.23",
"shasum": ""
},
"require": {
......@@ -646,12 +659,12 @@
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": ">=1.2.1,<1.3.0",
"phpunit/php-code-coverage": "~1.2.1",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
"phpunit/php-timer": ">=1.0.2,<1.1.0",
"phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0",
"symfony/yaml": ">=2.0.0,<2.3.0"
"phpunit/php-timer": ">=1.0.4",
"phpunit/phpunit-mock-objects": "~1.2.0",
"symfony/yaml": "~2.0"
},
"require-dev": {
"pear-pear/pear": "1.9.4"
......@@ -698,7 +711,7 @@
"testing",
"xunit"
],
"time": "2013-03-25 11:45:06"
"time": "2013-08-02 19:14:44"
},
{
"name": "phpunit/phpunit-mock-objects",
......@@ -751,26 +764,32 @@
},
{
"name": "symfony/console",
"version": "v2.2.1",
"version": "v2.3.3",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "v2.2.1"
"reference": "v2.3.3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.1",
"reference": "v2.2.1",
"url": "https://api.github.com/repos/symfony/Console/zipball/v2.3.3",
"reference": "v2.3.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/event-dispatcher": "~2.1"
},
"suggest": {
"symfony/event-dispatcher": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
"dev-master": "2.3-dev"
}
},
"autoload": {
......@@ -794,21 +813,21 @@
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
"time": "2013-03-19 20:48:08"
"time": "2013-07-21 12:12:18"
},
{
"name": "symfony/yaml",
"version": "v2.2.1",
"version": "v2.3.3",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "v2.2.1"
"reference": "v2.3.3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.1",
"reference": "v2.2.1",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.3.3",
"reference": "v2.3.3",
"shasum": ""
},
"require": {
......@@ -817,7 +836,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
"dev-master": "2.3-dev"
}
},
"autoload": {
......@@ -841,7 +860,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2013-03-23 07:49:54"
"time": "2013-07-21 12:12:18"
}
],
"aliases": [
......
......@@ -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