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
0e273a9c
Commit
0e273a9c
authored
May 04, 2020
by
Guilherme Blanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Normalized parameter name across platforms
parent
14dbd406
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
36 deletions
+39
-36
DB2Platform.php
src/Platforms/DB2Platform.php
+5
-3
MySqlPlatform.php
src/Platforms/MySqlPlatform.php
+7
-7
OraclePlatform.php
src/Platforms/OraclePlatform.php
+5
-5
PostgreSQL94Platform.php
src/Platforms/PostgreSQL94Platform.php
+4
-4
SQLAnywhere16Platform.php
src/Platforms/SQLAnywhere16Platform.php
+5
-5
SQLServer2012Platform.php
src/Platforms/SQLServer2012Platform.php
+13
-12
No files found.
src/Platforms/DB2Platform.php
View file @
0e273a9c
...
...
@@ -489,18 +489,20 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$
tableN
ame
,
array
$columns
,
array
$options
=
[])
protected
function
_getCreateTableSQL
(
$
n
ame
,
array
$columns
,
array
$options
=
[])
{
$indexes
=
[];
if
(
isset
(
$options
[
'indexes'
]))
{
$indexes
=
$options
[
'indexes'
];
}
$options
[
'indexes'
]
=
[];
$sqls
=
parent
::
_getCreateTableSQL
(
$
tableN
ame
,
$columns
,
$options
);
$sqls
=
parent
::
_getCreateTableSQL
(
$
n
ame
,
$columns
,
$options
);
foreach
(
$indexes
as
$definition
)
{
$sqls
[]
=
$this
->
getCreateIndexSQL
(
$definition
,
$
tableN
ame
);
$sqls
[]
=
$this
->
getCreateIndexSQL
(
$definition
,
$
n
ame
);
}
return
$sqls
;
...
...
src/Platforms/MySqlPlatform.php
View file @
0e273a9c
...
...
@@ -418,20 +418,20 @@ SQL
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$
tableN
ame
,
array
$columns
,
array
$options
=
[])
protected
function
_getCreateTableSQL
(
$
n
ame
,
array
$columns
,
array
$options
=
[])
{
$queryFields
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
if
(
isset
(
$options
[
'uniqueConstraints'
])
&&
!
empty
(
$options
[
'uniqueConstraints'
]))
{
foreach
(
$options
[
'uniqueConstraints'
]
as
$
n
ame
=>
$definition
)
{
$queryFields
.=
', '
.
$this
->
getUniqueConstraintDeclarationSQL
(
$
n
ame
,
$definition
);
foreach
(
$options
[
'uniqueConstraints'
]
as
$
constraintN
ame
=>
$definition
)
{
$queryFields
.=
', '
.
$this
->
getUniqueConstraintDeclarationSQL
(
$
constraintN
ame
,
$definition
);
}
}
// add all indexes
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
as
$
n
ame
=>
$definition
)
{
$queryFields
.=
', '
.
$this
->
getIndexDeclarationSQL
(
$
n
ame
,
$definition
);
foreach
(
$options
[
'indexes'
]
as
$
indexN
ame
=>
$definition
)
{
$queryFields
.=
', '
.
$this
->
getIndexDeclarationSQL
(
$
indexN
ame
,
$definition
);
}
}
...
...
@@ -447,7 +447,7 @@ SQL
$query
.=
'TEMPORARY '
;
}
$query
.=
'TABLE '
.
$
tableN
ame
.
' ('
.
$queryFields
.
') '
;
$query
.=
'TABLE '
.
$
n
ame
.
' ('
.
$queryFields
.
') '
;
$query
.=
$this
->
buildTableOptions
(
$options
);
$query
.=
$this
->
buildPartitionOptions
(
$options
);
...
...
@@ -461,7 +461,7 @@ SQL
// Propagate foreign key constraints only for InnoDB.
if
(
isset
(
$options
[
'foreignKeys'
])
&&
$engine
===
'INNODB'
)
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$definition
)
{
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$
tableN
ame
);
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$
n
ame
);
}
}
...
...
src/Platforms/OraclePlatform.php
View file @
0e273a9c
...
...
@@ -380,13 +380,13 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$
tableN
ame
,
array
$columns
,
array
$options
=
[])
protected
function
_getCreateTableSQL
(
$
n
ame
,
array
$columns
,
array
$options
=
[])
{
$indexes
=
$options
[
'indexes'
]
??
[];
$options
[
'indexes'
]
=
[];
$sql
=
parent
::
_getCreateTableSQL
(
$
tableN
ame
,
$columns
,
$options
);
$sql
=
parent
::
_getCreateTableSQL
(
$
n
ame
,
$columns
,
$options
);
foreach
(
$columns
as
$
n
ame
=>
$column
)
{
foreach
(
$columns
as
$
columnN
ame
=>
$column
)
{
if
(
isset
(
$column
[
'sequence'
]))
{
$sql
[]
=
$this
->
getCreateSequenceSQL
(
$column
[
'sequence'
]);
}
...
...
@@ -396,12 +396,12 @@ class OraclePlatform extends AbstractPlatform
continue
;
}
$sql
=
array_merge
(
$sql
,
$this
->
getCreateAutoincrementSql
(
$
name
,
$tableN
ame
));
$sql
=
array_merge
(
$sql
,
$this
->
getCreateAutoincrementSql
(
$
columnName
,
$n
ame
));
}
if
(
isset
(
$indexes
)
&&
!
empty
(
$indexes
))
{
foreach
(
$indexes
as
$index
)
{
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
tableN
ame
);
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
n
ame
);
}
}
...
...
src/Platforms/PostgreSQL94Platform.php
View file @
0e273a9c
...
...
@@ -776,7 +776,7 @@ SQL
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$
tableN
ame
,
array
$columns
,
array
$options
=
[])
protected
function
_getCreateTableSQL
(
$
n
ame
,
array
$columns
,
array
$options
=
[])
{
$queryFields
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
...
...
@@ -785,19 +785,19 @@ SQL
$queryFields
.=
', PRIMARY KEY('
.
implode
(
', '
,
$keyColumns
)
.
')'
;
}
$query
=
'CREATE TABLE '
.
$
tableN
ame
.
' ('
.
$queryFields
.
')'
;
$query
=
'CREATE TABLE '
.
$
n
ame
.
' ('
.
$queryFields
.
')'
;
$sql
=
[
$query
];
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
as
$index
)
{
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
tableN
ame
);
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
n
ame
);
}
}
if
(
isset
(
$options
[
'foreignKeys'
]))
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$definition
)
{
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$
tableN
ame
);
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$
n
ame
);
}
}
...
...
src/Platforms/SQLAnywhere16Platform.php
View file @
0e273a9c
...
...
@@ -1292,21 +1292,21 @@ SQL
/**
* {@inheritdoc}
*/
protected
function
_getCreateTableSQL
(
$
tableN
ame
,
array
$columns
,
array
$options
=
[])
protected
function
_getCreateTableSQL
(
$
n
ame
,
array
$columns
,
array
$options
=
[])
{
$columnListSql
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
$indexSql
=
[];
if
(
!
empty
(
$options
[
'uniqueConstraints'
]))
{
foreach
((
array
)
$options
[
'uniqueConstraints'
]
as
$
n
ame
=>
$definition
)
{
$columnListSql
.=
', '
.
$this
->
getUniqueConstraintDeclarationSQL
(
$
n
ame
,
$definition
);
foreach
((
array
)
$options
[
'uniqueConstraints'
]
as
$
constraintN
ame
=>
$definition
)
{
$columnListSql
.=
', '
.
$this
->
getUniqueConstraintDeclarationSQL
(
$
constraintN
ame
,
$definition
);
}
}
if
(
!
empty
(
$options
[
'indexes'
]))
{
/** @var Index $index */
foreach
((
array
)
$options
[
'indexes'
]
as
$index
)
{
$indexSql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
tableN
ame
);
$indexSql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
n
ame
);
}
}
...
...
@@ -1326,7 +1326,7 @@ SQL
}
}
$query
=
'CREATE TABLE '
.
$
tableN
ame
.
' ('
.
$columnListSql
;
$query
=
'CREATE TABLE '
.
$
n
ame
.
' ('
.
$columnListSql
;
$check
=
$this
->
getCheckDeclarationSQL
(
$columns
);
if
(
!
empty
(
$check
))
{
...
...
src/Platforms/SQLServer2012Platform.php
View file @
0e273a9c
...
...
@@ -303,14 +303,14 @@ SQL
/**
* {@inheritDoc}
*/
protected
function
_getCreateTableSQL
(
$
tableN
ame
,
array
$columns
,
array
$options
=
[])
protected
function
_getCreateTableSQL
(
$
n
ame
,
array
$columns
,
array
$options
=
[])
{
$defaultConstraintsSql
=
[];
$commentsSql
=
[];
$tableComment
=
$options
[
'comment'
]
??
null
;
if
(
$tableComment
!==
null
)
{
$commentsSql
[]
=
$this
->
getCommentOnTableSQL
(
$
tableN
ame
,
$tableComment
);
$commentsSql
[]
=
$this
->
getCommentOnTableSQL
(
$
n
ame
,
$tableComment
);
}
// @todo does other code breaks because of this?
...
...
@@ -322,22 +322,22 @@ SQL
// Build default constraints SQL statements.
if
(
isset
(
$column
[
'default'
]))
{
$defaultConstraintsSql
[]
=
'ALTER TABLE '
.
$
tableN
ame
.
' ADD'
.
$this
->
getDefaultConstraintDeclarationSQL
(
$
tableN
ame
,
$column
);
$defaultConstraintsSql
[]
=
'ALTER TABLE '
.
$
n
ame
.
' ADD'
.
$this
->
getDefaultConstraintDeclarationSQL
(
$
n
ame
,
$column
);
}
if
(
empty
(
$column
[
'comment'
])
&&
!
is_numeric
(
$column
[
'comment'
]))
{
continue
;
}
$commentsSql
[]
=
$this
->
getCreateColumnCommentSQL
(
$
tableN
ame
,
$column
[
'name'
],
$column
[
'comment'
]);
$commentsSql
[]
=
$this
->
getCreateColumnCommentSQL
(
$
n
ame
,
$column
[
'name'
],
$column
[
'comment'
]);
}
$columnListSql
=
$this
->
getColumnDeclarationListSQL
(
$columns
);
if
(
isset
(
$options
[
'uniqueConstraints'
])
&&
!
empty
(
$options
[
'uniqueConstraints'
]))
{
foreach
(
$options
[
'uniqueConstraints'
]
as
$
n
ame
=>
$definition
)
{
$columnListSql
.=
', '
.
$this
->
getUniqueConstraintDeclarationSQL
(
$
n
ame
,
$definition
);
foreach
(
$options
[
'uniqueConstraints'
]
as
$
constraintN
ame
=>
$definition
)
{
$columnListSql
.=
', '
.
$this
->
getUniqueConstraintDeclarationSQL
(
$
constraintN
ame
,
$definition
);
}
}
...
...
@@ -349,25 +349,26 @@ SQL
$columnListSql
.=
', PRIMARY KEY'
.
$flags
.
' ('
.
implode
(
', '
,
array_unique
(
array_values
(
$options
[
'primary'
])))
.
')'
;
}
$query
=
'CREATE TABLE '
.
$tableName
.
' ('
.
$columnListSql
;
$query
=
'CREATE TABLE '
.
$name
.
' ('
.
$columnListSql
;
$check
=
$this
->
getCheckDeclarationSQL
(
$columns
);
if
(
!
empty
(
$check
))
{
$query
.=
', '
.
$check
;
}
$query
.=
')'
;
$sql
=
[
$query
];
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
as
$index
)
{
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
tableN
ame
);
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$
n
ame
);
}
}
if
(
isset
(
$options
[
'foreignKeys'
]))
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$definition
)
{
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$
tableN
ame
);
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$
n
ame
);
}
}
...
...
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