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
32d27fec
Commit
32d27fec
authored
Sep 02, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
take SQL Server quote characters into account for assets
parent
1c9c24a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
AbstractAsset.php
lib/Doctrine/DBAL/Schema/AbstractAsset.php
+2
-2
ColumnTest.php
tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
+30
-0
No files found.
lib/Doctrine/DBAL/Schema/AbstractAsset.php
View file @
32d27fec
...
...
@@ -155,7 +155,7 @@ abstract class AbstractAsset
*/
protected
function
isIdentifierQuoted
(
$identifier
)
{
return
(
isset
(
$identifier
[
0
])
&&
(
$identifier
[
0
]
==
'`'
||
$identifier
[
0
]
==
'"'
));
return
(
isset
(
$identifier
[
0
])
&&
(
$identifier
[
0
]
==
'`'
||
$identifier
[
0
]
==
'"'
||
$identifier
[
0
]
==
'['
));
}
/**
...
...
@@ -167,7 +167,7 @@ abstract class AbstractAsset
*/
protected
function
trimQuotes
(
$identifier
)
{
return
str_replace
(
array
(
'`'
,
'"'
),
''
,
$identifier
);
return
str_replace
(
array
(
'`'
,
'"'
,
'['
,
']'
),
''
,
$identifier
);
}
/**
...
...
tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
View file @
32d27fec
...
...
@@ -80,6 +80,7 @@ class ColumnTest extends \PHPUnit_Framework_TestCase
/**
* @group DBAL-64
* @group DBAL-830
*/
public
function
testQuotedColumnName
()
{
...
...
@@ -92,6 +93,35 @@ class ColumnTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'bar'
,
$column
->
getName
());
$this
->
assertEquals
(
'`bar`'
,
$column
->
getQuotedName
(
$mysqlPlatform
));
$this
->
assertEquals
(
'"bar"'
,
$column
->
getQuotedName
(
$sqlitePlatform
));
$column
=
new
Column
(
"[bar]"
,
$string
);
$sqlServerPlatform
=
new
\Doctrine\DBAL\Platforms\SQLServerPlatform
();
$this
->
assertEquals
(
'bar'
,
$column
->
getName
());
$this
->
assertEquals
(
'[bar]'
,
$column
->
getQuotedName
(
$sqlServerPlatform
));
}
/**
* @dataProvider getIsQuoted
* @group DBAL-830
*/
public
function
testIsQuoted
(
$columnName
,
$isQuoted
)
{
$type
=
Type
::
getType
(
'string'
);
$column
=
new
Column
(
$columnName
,
$type
);
$this
->
assertSame
(
$isQuoted
,
$column
->
isQuoted
());
}
public
function
getIsQuoted
()
{
return
array
(
array
(
'bar'
,
false
),
array
(
'`bar`'
,
true
),
array
(
'"bar"'
,
true
),
array
(
'[bar]'
,
true
),
);
}
/**
...
...
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