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
60a19586
Commit
60a19586
authored
Aug 29, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #671 from josemalonsom/fix-quoted-integers-as-default-value
Fix quoted integers as default value.
parents
1c9c24a7
df299d79
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+1
-1
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+1
-1
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+15
-0
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
60a19586
...
...
@@ -2241,7 +2241,7 @@ abstract class AbstractPlatform
if
(
isset
(
$field
[
'default'
]))
{
$default
=
" DEFAULT '"
.
$field
[
'default'
]
.
"'"
;
if
(
isset
(
$field
[
'type'
]))
{
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
"Integer"
,
"BigInt
eger"
,
"SmallInteger
"
)))
{
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
"Integer"
,
"BigInt
"
,
"SmallInt
"
)))
{
$default
=
" DEFAULT "
.
$field
[
'default'
];
}
elseif
(
in_array
((
string
)
$field
[
'type'
],
array
(
'DateTime'
,
'DateTimeTz'
))
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
$default
=
" DEFAULT "
.
$this
->
getCurrentTimestampSQL
();
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
60a19586
...
...
@@ -1454,7 +1454,7 @@ class SQLServerPlatform extends AbstractPlatform
return
" DEFAULT '"
.
$field
[
'default'
]
.
"'"
;
}
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
'Integer'
,
'BigInt
eger'
,
'SmallInteger
'
)))
{
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
'Integer'
,
'BigInt
'
,
'SmallInt
'
)))
{
return
" DEFAULT "
.
$field
[
'default'
];
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
60a19586
...
...
@@ -466,6 +466,21 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
}
}
public
function
testGetDefaultValueDeclarationSQLForIntegerTypes
()
{
foreach
(
array
(
'bigint'
,
'integer'
,
'smallint'
)
as
$type
)
{
$field
=
array
(
'type'
=>
Type
::
getType
(
$type
),
'default'
=>
1
);
$this
->
assertEquals
(
' DEFAULT 1'
,
$this
->
_platform
->
getDefaultValueDeclarationSQL
(
$field
)
);
}
}
/**
* @group DBAL-45
*/
...
...
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