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
7301a601
Commit
7301a601
authored
Jan 06, 2016
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quote reserved keywords in TRUNCATE TABLE SQL
fixes #2270
parent
ca4eea9f
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
97 additions
and
7 deletions
+97
-7
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+3
-1
DB2Platform.php
lib/Doctrine/DBAL/Platforms/DB2Platform.php
+3
-1
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+3
-1
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+8
-1
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+3
-1
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+3
-1
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+2
-1
AbstractMySQLPlatformTestCase.php
...ne/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
+8
-0
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+16
-0
AbstractPostgreSqlPlatformTestCase.php
...sts/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
+8
-0
AbstractSQLServerPlatformTestCase.php
...ests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
+8
-0
DB2PlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
+8
-0
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+8
-0
SQLAnywherePlatformTest.php
...Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+8
-0
SqlitePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
+8
-0
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
7301a601
...
...
@@ -3412,7 +3412,9 @@ abstract class AbstractPlatform
*/
public
function
getTruncateTableSQL
(
$tableName
,
$cascade
=
false
)
{
return
'TRUNCATE '
.
$tableName
;
$tableIdentifier
=
new
Identifier
(
$tableName
);
return
'TRUNCATE '
.
$tableIdentifier
->
getQuotedName
(
$this
);
}
/**
...
...
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
7301a601
...
...
@@ -233,7 +233,9 @@ class DB2Platform extends AbstractPlatform
*/
public
function
getTruncateTableSQL
(
$tableName
,
$cascade
=
false
)
{
return
'TRUNCATE '
.
$tableName
.
' IMMEDIATE'
;
$tableIdentifier
=
new
Identifier
(
$tableName
);
return
'TRUNCATE '
.
$tableIdentifier
->
getQuotedName
(
$this
)
.
' IMMEDIATE'
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
7301a601
...
...
@@ -1082,7 +1082,9 @@ END;';
*/
public
function
getTruncateTableSQL
(
$tableName
,
$cascade
=
false
)
{
return
'TRUNCATE TABLE '
.
$tableName
;
$tableIdentifier
=
new
Identifier
(
$tableName
);
return
'TRUNCATE TABLE '
.
$tableIdentifier
->
getQuotedName
(
$this
);
}
/**
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
7301a601
...
...
@@ -1068,7 +1068,14 @@ class PostgreSqlPlatform extends AbstractPlatform
*/
public
function
getTruncateTableSQL
(
$tableName
,
$cascade
=
false
)
{
return
'TRUNCATE '
.
$tableName
.
' '
.
((
$cascade
)
?
'CASCADE'
:
''
);
$tableIdentifier
=
new
Identifier
(
$tableName
);
$sql
=
'TRUNCATE '
.
$tableIdentifier
->
getQuotedName
(
$this
);
if
(
$cascade
)
{
$sql
.=
' CASCADE'
;
}
return
$sql
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
7301a601
...
...
@@ -1124,7 +1124,9 @@ class SQLAnywherePlatform extends AbstractPlatform
*/
public
function
getTruncateTableSQL
(
$tableName
,
$cascade
=
false
)
{
return
'TRUNCATE TABLE '
.
$tableName
;
$tableIdentifier
=
new
Identifier
(
$tableName
);
return
'TRUNCATE TABLE '
.
$tableIdentifier
->
getQuotedName
(
$this
);
}
/**
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
7301a601
...
...
@@ -1490,7 +1490,9 @@ class SQLServerPlatform extends AbstractPlatform
*/
public
function
getTruncateTableSQL
(
$tableName
,
$cascade
=
false
)
{
return
'TRUNCATE TABLE '
.
$tableName
;
$tableIdentifier
=
new
Identifier
(
$tableName
);
return
'TRUNCATE TABLE '
.
$tableIdentifier
->
getQuotedName
(
$this
);
}
/**
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
7301a601
...
...
@@ -505,7 +505,8 @@ class SqlitePlatform extends AbstractPlatform
*/
public
function
getTruncateTableSQL
(
$tableName
,
$cascade
=
false
)
{
$tableName
=
str_replace
(
'.'
,
'__'
,
$tableName
);
$tableIdentifier
=
new
Identifier
(
$tableName
);
$tableName
=
str_replace
(
'.'
,
'__'
,
$tableIdentifier
->
getQuotedName
(
$this
));
return
'DELETE FROM '
.
$tableName
;
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
View file @
7301a601
...
...
@@ -691,6 +691,14 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
return
'INDEX `select` (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getQuotesReservedKeywordInTruncateTableSQL
()
{
return
'TRUNCATE `select`'
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
7301a601
...
...
@@ -621,6 +621,22 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
*/
abstract
protected
function
getQuotesReservedKeywordInUniqueConstraintDeclarationSQL
();
/**
* @group DBAL-2270
*/
public
function
testQuotesReservedKeywordInTruncateTableSQL
()
{
$this
->
assertSame
(
$this
->
getQuotesReservedKeywordInTruncateTableSQL
(),
$this
->
_platform
->
getTruncateTableSQL
(
'select'
)
);
}
/**
* @return string
*/
abstract
protected
function
getQuotesReservedKeywordInTruncateTableSQL
();
/**
* @group DBAL-1051
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
View file @
7301a601
...
...
@@ -764,6 +764,14 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
return
'INDEX "select" (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getQuotesReservedKeywordInTruncateTableSQL
()
{
return
'TRUNCATE "select"'
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
View file @
7301a601
...
...
@@ -1301,6 +1301,14 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
return
'INDEX [select] (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getQuotesReservedKeywordInTruncateTableSQL
()
{
return
'TRUNCATE TABLE [select]'
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
View file @
7301a601
...
...
@@ -640,6 +640,14 @@ class DB2PlatformTest extends AbstractPlatformTestCase
return
''
;
// not supported by this platform
}
/**
* {@inheritdoc}
*/
protected
function
getQuotesReservedKeywordInTruncateTableSQL
()
{
return
'TRUNCATE "select" IMMEDIATE'
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
7301a601
...
...
@@ -707,6 +707,14 @@ EOD;
return
'INDEX "select" (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getQuotesReservedKeywordInTruncateTableSQL
()
{
return
'TRUNCATE TABLE "select"'
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View file @
7301a601
...
...
@@ -960,6 +960,14 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
return
''
;
// not supported by this platform
}
/**
* {@inheritdoc}
*/
protected
function
getQuotesReservedKeywordInTruncateTableSQL
()
{
return
'TRUNCATE TABLE "select"'
;
}
/**
* {@inheritdoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
View file @
7301a601
...
...
@@ -637,6 +637,14 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
return
'INDEX "select" (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getQuotesReservedKeywordInTruncateTableSQL
()
{
return
'DELETE FROM "select"'
;
}
/**
* {@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