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
f59df8ca
Commit
f59df8ca
authored
Nov 17, 2010
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBAL-64 - Fix Platforms to use AbstractAsset::getQuotedName() in all occourances
parent
36bb5429
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
46 deletions
+46
-46
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+14
-14
DB2Platform.php
lib/Doctrine/DBAL/Platforms/DB2Platform.php
+4
-4
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+8
-8
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+7
-7
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+8
-8
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+5
-5
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
f59df8ca
...
@@ -672,7 +672,7 @@ abstract class AbstractPlatform
...
@@ -672,7 +672,7 @@ abstract class AbstractPlatform
public
function
getDropTableSQL
(
$table
)
public
function
getDropTableSQL
(
$table
)
{
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
return
'DROP TABLE '
.
$table
;
return
'DROP TABLE '
.
$table
;
...
@@ -688,7 +688,7 @@ abstract class AbstractPlatform
...
@@ -688,7 +688,7 @@ abstract class AbstractPlatform
public
function
getDropIndexSQL
(
$index
,
$table
=
null
)
public
function
getDropIndexSQL
(
$index
,
$table
=
null
)
{
{
if
(
$index
instanceof
\Doctrine\DBAL\Schema\Index
)
{
if
(
$index
instanceof
\Doctrine\DBAL\Schema\Index
)
{
$index
=
$index
->
get
Name
(
);
$index
=
$index
->
get
QuotedName
(
$this
);
}
else
if
(
!
is_string
(
$index
))
{
}
else
if
(
!
is_string
(
$index
))
{
throw
new
\InvalidArgumentException
(
'AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'
);
throw
new
\InvalidArgumentException
(
'AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'
);
}
}
...
@@ -706,11 +706,11 @@ abstract class AbstractPlatform
...
@@ -706,11 +706,11 @@ abstract class AbstractPlatform
public
function
getDropConstraintSQL
(
$constraint
,
$table
)
public
function
getDropConstraintSQL
(
$constraint
,
$table
)
{
{
if
(
$constraint
instanceof
\Doctrine\DBAL\Schema\Constraint
)
{
if
(
$constraint
instanceof
\Doctrine\DBAL\Schema\Constraint
)
{
$constraint
=
$constraint
->
get
Name
(
);
$constraint
=
$constraint
->
get
QuotedName
(
$this
);
}
}
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
return
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$constraint
;
return
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$constraint
;
...
@@ -724,11 +724,11 @@ abstract class AbstractPlatform
...
@@ -724,11 +724,11 @@ abstract class AbstractPlatform
public
function
getDropForeignKeySQL
(
$foreignKey
,
$table
)
public
function
getDropForeignKeySQL
(
$foreignKey
,
$table
)
{
{
if
(
$foreignKey
instanceof
\Doctrine\DBAL\Schema\ForeignKeyConstraint
)
{
if
(
$foreignKey
instanceof
\Doctrine\DBAL\Schema\ForeignKeyConstraint
)
{
$foreignKey
=
$foreignKey
->
get
Name
(
);
$foreignKey
=
$foreignKey
->
get
QuotedName
(
$this
);
}
}
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
return
'ALTER TABLE '
.
$table
.
' DROP FOREIGN KEY '
.
$foreignKey
;
return
'ALTER TABLE '
.
$table
.
' DROP FOREIGN KEY '
.
$foreignKey
;
...
@@ -752,7 +752,7 @@ abstract class AbstractPlatform
...
@@ -752,7 +752,7 @@ abstract class AbstractPlatform
throw
DBALException
::
noColumnsSpecifiedForTable
(
$table
->
getName
());
throw
DBALException
::
noColumnsSpecifiedForTable
(
$table
->
getName
());
}
}
$tableName
=
$table
->
get
Name
(
);
$tableName
=
$table
->
get
QuotedName
(
$this
);
$options
=
$table
->
getOptions
();
$options
=
$table
->
getOptions
();
$options
[
'uniqueConstraints'
]
=
array
();
$options
[
'uniqueConstraints'
]
=
array
();
$options
[
'indexes'
]
=
array
();
$options
[
'indexes'
]
=
array
();
...
@@ -773,7 +773,7 @@ abstract class AbstractPlatform
...
@@ -773,7 +773,7 @@ abstract class AbstractPlatform
foreach
(
$table
->
getColumns
()
AS
$column
)
{
foreach
(
$table
->
getColumns
()
AS
$column
)
{
/* @var \Doctrine\DBAL\Schema\Column $column */
/* @var \Doctrine\DBAL\Schema\Column $column */
$columnData
=
array
();
$columnData
=
array
();
$columnData
[
'name'
]
=
$column
->
get
Name
(
);
$columnData
[
'name'
]
=
$column
->
get
QuotedName
(
$this
);
$columnData
[
'type'
]
=
$column
->
getType
();
$columnData
[
'type'
]
=
$column
->
getType
();
$columnData
[
'length'
]
=
$column
->
getLength
();
$columnData
[
'length'
]
=
$column
->
getLength
();
$columnData
[
'notnull'
]
=
$column
->
getNotNull
();
$columnData
[
'notnull'
]
=
$column
->
getNotNull
();
...
@@ -876,10 +876,10 @@ abstract class AbstractPlatform
...
@@ -876,10 +876,10 @@ abstract class AbstractPlatform
public
function
getCreateConstraintSQL
(
\Doctrine\DBAL\Schema\Constraint
$constraint
,
$table
)
public
function
getCreateConstraintSQL
(
\Doctrine\DBAL\Schema\Constraint
$constraint
,
$table
)
{
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
$query
=
'ALTER TABLE '
.
$table
.
' ADD CONSTRAINT '
.
$constraint
->
get
Name
(
);
$query
=
'ALTER TABLE '
.
$table
.
' ADD CONSTRAINT '
.
$constraint
->
get
QuotedName
(
$this
);
$columns
=
array
();
$columns
=
array
();
foreach
(
$constraint
->
getColumns
()
as
$column
)
{
foreach
(
$constraint
->
getColumns
()
as
$column
)
{
...
@@ -923,9 +923,9 @@ abstract class AbstractPlatform
...
@@ -923,9 +923,9 @@ abstract class AbstractPlatform
public
function
getCreateIndexSQL
(
Index
$index
,
$table
)
public
function
getCreateIndexSQL
(
Index
$index
,
$table
)
{
{
if
(
$table
instanceof
Table
)
{
if
(
$table
instanceof
Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
$name
=
$index
->
get
Name
(
);
$name
=
$index
->
get
QuotedName
(
$this
);
$columns
=
$index
->
getColumns
();
$columns
=
$index
->
getColumns
();
if
(
count
(
$columns
)
==
0
)
{
if
(
count
(
$columns
)
==
0
)
{
...
@@ -972,7 +972,7 @@ abstract class AbstractPlatform
...
@@ -972,7 +972,7 @@ abstract class AbstractPlatform
public
function
getCreateForeignKeySQL
(
ForeignKeyConstraint
$foreignKey
,
$table
)
public
function
getCreateForeignKeySQL
(
ForeignKeyConstraint
$foreignKey
,
$table
)
{
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
$query
=
'ALTER TABLE '
.
$table
.
' ADD '
.
$this
->
getForeignKeyDeclarationSQL
(
$foreignKey
);
$query
=
'ALTER TABLE '
.
$table
.
' ADD '
.
$this
->
getForeignKeyDeclarationSQL
(
$foreignKey
);
...
@@ -1423,7 +1423,7 @@ abstract class AbstractPlatform
...
@@ -1423,7 +1423,7 @@ abstract class AbstractPlatform
{
{
$sql
=
''
;
$sql
=
''
;
if
(
strlen
(
$foreignKey
->
getName
()))
{
if
(
strlen
(
$foreignKey
->
getName
()))
{
$sql
.=
'CONSTRAINT '
.
$foreignKey
->
get
Name
(
)
.
' '
;
$sql
.=
'CONSTRAINT '
.
$foreignKey
->
get
QuotedName
(
$this
)
.
' '
;
}
}
$sql
.=
'FOREIGN KEY ('
;
$sql
.=
'FOREIGN KEY ('
;
...
...
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
f59df8ca
...
@@ -379,22 +379,22 @@ class DB2Platform extends AbstractPlatform
...
@@ -379,22 +379,22 @@ class DB2Platform extends AbstractPlatform
$queryParts
=
array
();
$queryParts
=
array
();
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
$queryParts
[]
=
'ADD COLUMN '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
$queryParts
[]
=
'ADD COLUMN '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
AS
$column
)
{
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
get
Name
(
);
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
get
QuotedName
(
$this
);
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
$column
=
$columnDiff
->
column
;
$column
=
$columnDiff
->
column
;
$queryParts
[]
=
'ALTER '
.
(
$columnDiff
->
oldColumnName
)
.
' '
$queryParts
[]
=
'ALTER '
.
(
$columnDiff
->
oldColumnName
)
.
' '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
$queryParts
[]
=
'RENAME '
.
$oldColumnName
.
' TO '
.
$column
->
get
Name
(
);
$queryParts
[]
=
'RENAME '
.
$oldColumnName
.
' TO '
.
$column
->
get
QuotedName
(
$this
);
}
}
if
(
count
(
$queryParts
)
>
0
)
{
if
(
count
(
$queryParts
)
>
0
)
{
...
...
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
f59df8ca
...
@@ -114,11 +114,11 @@ DROP DATABASE ' . $name . ';';
...
@@ -114,11 +114,11 @@ DROP DATABASE ' . $name . ';';
public
function
getDropForeignKeySQL
(
$foreignKey
,
$table
)
public
function
getDropForeignKeySQL
(
$foreignKey
,
$table
)
{
{
if
(
$foreignKey
instanceof
\Doctrine\DBAL\Schema\ForeignKeyConstraint
)
{
if
(
$foreignKey
instanceof
\Doctrine\DBAL\Schema\ForeignKeyConstraint
)
{
$foreignKey
=
$foreignKey
->
get
Name
(
);
$foreignKey
=
$foreignKey
->
get
QuotedName
(
$this
);
}
}
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
return
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$foreignKey
;
return
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$foreignKey
;
...
@@ -131,7 +131,7 @@ DROP DATABASE ' . $name . ';';
...
@@ -131,7 +131,7 @@ DROP DATABASE ' . $name . ';';
{
{
if
(
$index
instanceof
\Doctrine\DBAL\Schema\Index
)
{
if
(
$index
instanceof
\Doctrine\DBAL\Schema\Index
)
{
$index_
=
$index
;
$index_
=
$index
;
$index
=
$index
->
get
Name
(
);
$index
=
$index
->
get
QuotedName
(
$this
);
}
else
if
(
!
is_string
(
$index
))
{
}
else
if
(
!
is_string
(
$index
))
{
throw
new
\InvalidArgumentException
(
'AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'
);
throw
new
\InvalidArgumentException
(
'AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'
);
}
}
...
@@ -140,7 +140,7 @@ DROP DATABASE ' . $name . ';';
...
@@ -140,7 +140,7 @@ DROP DATABASE ' . $name . ';';
return
'DROP INDEX '
.
$index
;
return
'DROP INDEX '
.
$index
;
}
else
{
}
else
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
return
"IF EXISTS (SELECT * FROM sysobjects WHERE name = '
$index
')
return
"IF EXISTS (SELECT * FROM sysobjects WHERE name = '
$index
')
...
@@ -231,23 +231,23 @@ DROP DATABASE ' . $name . ';';
...
@@ -231,23 +231,23 @@ DROP DATABASE ' . $name . ';';
}
}
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
AS
$column
)
{
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
get
Name
(
);
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
get
QuotedName
(
$this
);
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
$column
=
$columnDiff
->
column
;
$column
=
$columnDiff
->
column
;
$queryParts
[]
=
'CHANGE '
.
(
$columnDiff
->
oldColumnName
)
.
' '
$queryParts
[]
=
'CHANGE '
.
(
$columnDiff
->
oldColumnName
)
.
' '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
$queryParts
[]
=
'CHANGE '
.
$oldColumnName
.
' '
$queryParts
[]
=
'CHANGE '
.
$oldColumnName
.
' '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
$sql
=
array
();
$sql
=
array
();
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
f59df8ca
...
@@ -410,23 +410,23 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -410,23 +410,23 @@ class MySqlPlatform extends AbstractPlatform
}
}
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
AS
$column
)
{
$queryParts
[]
=
'DROP '
.
$column
->
get
Name
(
);
$queryParts
[]
=
'DROP '
.
$column
->
get
QuotedName
(
$this
);
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
$column
=
$columnDiff
->
column
;
$column
=
$columnDiff
->
column
;
$queryParts
[]
=
'CHANGE '
.
(
$columnDiff
->
oldColumnName
)
.
' '
$queryParts
[]
=
'CHANGE '
.
(
$columnDiff
->
oldColumnName
)
.
' '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
$queryParts
[]
=
'CHANGE '
.
$oldColumnName
.
' '
$queryParts
[]
=
'CHANGE '
.
$oldColumnName
.
' '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
$sql
=
array
();
$sql
=
array
();
...
@@ -520,13 +520,13 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -520,13 +520,13 @@ class MySqlPlatform extends AbstractPlatform
public
function
getDropIndexSQL
(
$index
,
$table
=
null
)
public
function
getDropIndexSQL
(
$index
,
$table
=
null
)
{
{
if
(
$index
instanceof
\Doctrine\DBAL\Schema\Index
)
{
if
(
$index
instanceof
\Doctrine\DBAL\Schema\Index
)
{
$index
=
$index
->
get
Name
(
);
$index
=
$index
->
get
QuotedName
(
$this
);
}
else
if
(
!
is_string
(
$index
))
{
}
else
if
(
!
is_string
(
$index
))
{
throw
new
\InvalidArgumentException
(
'MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'
);
throw
new
\InvalidArgumentException
(
'MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'
);
}
}
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
else
if
(
!
is_string
(
$table
))
{
}
else
if
(
!
is_string
(
$table
))
{
throw
new
\InvalidArgumentException
(
'MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'
);
throw
new
\InvalidArgumentException
(
'MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'
);
}
}
...
@@ -543,7 +543,7 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -543,7 +543,7 @@ class MySqlPlatform extends AbstractPlatform
public
function
getDropTableSQL
(
$table
)
public
function
getDropTableSQL
(
$table
)
{
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
else
if
(
!
is_string
(
$table
))
{
}
else
if
(
!
is_string
(
$table
))
{
throw
new
\InvalidArgumentException
(
'MysqlPlatform::getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'
);
throw
new
\InvalidArgumentException
(
'MysqlPlatform::getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'
);
}
}
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
f59df8ca
...
@@ -113,7 +113,7 @@ class OraclePlatform extends AbstractPlatform
...
@@ -113,7 +113,7 @@ class OraclePlatform extends AbstractPlatform
*/
*/
public
function
getCreateSequenceSQL
(
\Doctrine\DBAL\Schema\Sequence
$sequence
)
public
function
getCreateSequenceSQL
(
\Doctrine\DBAL\Schema\Sequence
$sequence
)
{
{
return
'CREATE SEQUENCE '
.
$sequence
->
get
Name
(
)
.
return
'CREATE SEQUENCE '
.
$sequence
->
get
QuotedName
(
$this
)
.
' START WITH '
.
$sequence
->
getInitialValue
()
.
' START WITH '
.
$sequence
->
getInitialValue
()
.
' MINVALUE '
.
$sequence
->
getInitialValue
()
.
' MINVALUE '
.
$sequence
->
getInitialValue
()
.
' INCREMENT BY '
.
$sequence
->
getAllocationSize
();
' INCREMENT BY '
.
$sequence
->
getAllocationSize
();
...
@@ -455,7 +455,7 @@ LEFT JOIN all_cons_columns r_cols
...
@@ -455,7 +455,7 @@ LEFT JOIN all_cons_columns r_cols
public
function
getDropSequenceSQL
(
$sequence
)
public
function
getDropSequenceSQL
(
$sequence
)
{
{
if
(
$sequence
instanceof
\Doctrine\DBAL\Schema\Sequence
)
{
if
(
$sequence
instanceof
\Doctrine\DBAL\Schema\Sequence
)
{
$sequence
=
$sequence
->
get
Name
(
);
$sequence
=
$sequence
->
get
QuotedName
(
$this
);
}
}
return
'DROP SEQUENCE '
.
$sequence
;
return
'DROP SEQUENCE '
.
$sequence
;
...
@@ -469,11 +469,11 @@ LEFT JOIN all_cons_columns r_cols
...
@@ -469,11 +469,11 @@ LEFT JOIN all_cons_columns r_cols
public
function
getDropForeignKeySQL
(
$foreignKey
,
$table
)
public
function
getDropForeignKeySQL
(
$foreignKey
,
$table
)
{
{
if
(
$foreignKey
instanceof
\Doctrine\DBAL\Schema\ForeignKeyConstraint
)
{
if
(
$foreignKey
instanceof
\Doctrine\DBAL\Schema\ForeignKeyConstraint
)
{
$foreignKey
=
$foreignKey
->
get
Name
(
);
$foreignKey
=
$foreignKey
->
get
QuotedName
(
$this
);
}
}
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
if
(
$table
instanceof
\Doctrine\DBAL\Schema\Table
)
{
$table
=
$table
->
get
Name
(
);
$table
=
$table
->
get
QuotedName
(
$this
);
}
}
return
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$foreignKey
;
return
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$foreignKey
;
...
@@ -502,7 +502,7 @@ LEFT JOIN all_cons_columns r_cols
...
@@ -502,7 +502,7 @@ LEFT JOIN all_cons_columns r_cols
$fields
=
array
();
$fields
=
array
();
foreach
(
$diff
->
addedColumns
AS
$column
)
{
foreach
(
$diff
->
addedColumns
AS
$column
)
{
$fields
[]
=
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
$fields
[]
=
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
}
}
if
(
count
(
$fields
))
{
if
(
count
(
$fields
))
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' ADD ('
.
implode
(
', '
,
$fields
)
.
')'
;
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' ADD ('
.
implode
(
', '
,
$fields
)
.
')'
;
...
@@ -511,19 +511,19 @@ LEFT JOIN all_cons_columns r_cols
...
@@ -511,19 +511,19 @@ LEFT JOIN all_cons_columns r_cols
$fields
=
array
();
$fields
=
array
();
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
$column
=
$columnDiff
->
column
;
$column
=
$columnDiff
->
column
;
$fields
[]
=
$column
->
get
Name
(
)
.
' '
.
$this
->
getColumnDeclarationSQL
(
''
,
$column
->
toArray
());
$fields
[]
=
$column
->
get
QuotedName
(
$this
)
.
' '
.
$this
->
getColumnDeclarationSQL
(
''
,
$column
->
toArray
());
}
}
if
(
count
(
$fields
))
{
if
(
count
(
$fields
))
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' MODIFY ('
.
implode
(
', '
,
$fields
)
.
')'
;
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' MODIFY ('
.
implode
(
', '
,
$fields
)
.
')'
;
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' RENAME COLUMN '
.
$oldColumnName
.
' TO '
.
$column
->
get
Name
(
);
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' RENAME COLUMN '
.
$oldColumnName
.
' TO '
.
$column
->
get
QuotedName
(
$this
);
}
}
$fields
=
array
();
$fields
=
array
();
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
AS
$column
)
{
$fields
[]
=
$column
->
get
Name
(
);
$fields
[]
=
$column
->
get
QuotedName
(
$this
);
}
}
if
(
count
(
$fields
))
{
if
(
count
(
$fields
))
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' DROP COLUMN '
.
implode
(
', '
,
$fields
);
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' DROP COLUMN '
.
implode
(
', '
,
$fields
);
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
f59df8ca
...
@@ -342,12 +342,12 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -342,12 +342,12 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql
=
array
();
$sql
=
array
();
foreach
(
$diff
->
addedColumns
as
$column
)
{
foreach
(
$diff
->
addedColumns
as
$column
)
{
$query
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
Name
(
),
$column
->
toArray
());
$query
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
get
QuotedName
(
$this
),
$column
->
toArray
());
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
$query
;
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
$query
;
}
}
foreach
(
$diff
->
removedColumns
as
$column
)
{
foreach
(
$diff
->
removedColumns
as
$column
)
{
$query
=
'DROP '
.
$column
->
get
Name
(
);
$query
=
'DROP '
.
$column
->
get
QuotedName
(
$this
);
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
$query
;
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
$query
;
}
}
...
@@ -388,7 +388,7 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -388,7 +388,7 @@ class PostgreSqlPlatform extends AbstractPlatform
}
}
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' RENAME COLUMN '
.
$oldColumnName
.
' TO '
.
$column
->
get
Name
(
);
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' RENAME COLUMN '
.
$oldColumnName
.
' TO '
.
$column
->
get
QuotedName
(
$this
);
}
}
if
(
$diff
->
newName
!==
false
)
{
if
(
$diff
->
newName
!==
false
)
{
...
@@ -408,7 +408,7 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -408,7 +408,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/
*/
public
function
getCreateSequenceSQL
(
\Doctrine\DBAL\Schema\Sequence
$sequence
)
public
function
getCreateSequenceSQL
(
\Doctrine\DBAL\Schema\Sequence
$sequence
)
{
{
return
'CREATE SEQUENCE '
.
$sequence
->
get
Name
(
)
.
return
'CREATE SEQUENCE '
.
$sequence
->
get
QuotedName
(
$this
)
.
' INCREMENT BY '
.
$sequence
->
getAllocationSize
()
.
' INCREMENT BY '
.
$sequence
->
getAllocationSize
()
.
' MINVALUE '
.
$sequence
->
getInitialValue
()
.
' MINVALUE '
.
$sequence
->
getInitialValue
()
.
' START '
.
$sequence
->
getInitialValue
();
' START '
.
$sequence
->
getInitialValue
();
...
@@ -422,7 +422,7 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -422,7 +422,7 @@ class PostgreSqlPlatform extends AbstractPlatform
public
function
getDropSequenceSQL
(
$sequence
)
public
function
getDropSequenceSQL
(
$sequence
)
{
{
if
(
$sequence
instanceof
\Doctrine\DBAL\Schema\Sequence
)
{
if
(
$sequence
instanceof
\Doctrine\DBAL\Schema\Sequence
)
{
$sequence
=
$sequence
->
get
Name
(
);
$sequence
=
$sequence
->
get
QuotedName
(
$this
);
}
}
return
'DROP SEQUENCE '
.
$sequence
;
return
'DROP SEQUENCE '
.
$sequence
;
}
}
...
...
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