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
56f21931
Commit
56f21931
authored
Aug 29, 2012
by
Padraig O'Sullivan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update fix for issue with bigint type to work for both postgresql and mysql.
parent
9c12f43c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
BigIntType.php
lib/Doctrine/DBAL/Types/BigIntType.php
+18
-0
TypeConversionTest.php
tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php
+1
-2
No files found.
lib/Doctrine/DBAL/Types/BigIntType.php
View file @
56f21931
...
@@ -45,4 +45,22 @@ class BigIntType extends Type
...
@@ -45,4 +45,22 @@ class BigIntType extends Type
{
{
return
\PDO
::
PARAM_STR
;
return
\PDO
::
PARAM_STR
;
}
}
/**
* {@inheritdoc}
*/
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
if
(
null
===
$value
)
{
return
$value
;
}
/*
* PostgreSQL detects 32 vs 64 bit systems and casts correctly
* for bigint types.
*/
if
(
$platform
->
getName
()
===
'postgresql'
&&
PHP_INT_SIZE
!==
4
)
{
return
(
string
)
$value
;
}
return
$value
;
}
}
}
tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php
View file @
56f21931
...
@@ -48,13 +48,12 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -48,13 +48,12 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$obj
=
new
\stdClass
();
$obj
=
new
\stdClass
();
$obj
->
foo
=
"bar"
;
$obj
->
foo
=
"bar"
;
$obj
->
bar
=
"baz"
;
$obj
->
bar
=
"baz"
;
$bigIntExpectedPhpType
=
(
PHP_INT_SIZE
===
4
)
?
'string'
:
'int'
;
return
array
(
return
array
(
array
(
'string'
,
'ABCDEFGaaaBBB'
,
'string'
),
array
(
'string'
,
'ABCDEFGaaaBBB'
,
'string'
),
array
(
'boolean'
,
true
,
'bool'
),
array
(
'boolean'
,
true
,
'bool'
),
array
(
'boolean'
,
false
,
'bool'
),
array
(
'boolean'
,
false
,
'bool'
),
array
(
'bigint'
,
12345678
,
$bigIntExpectedPhpType
),
array
(
'bigint'
,
12345678
,
'string'
),
array
(
'smallint'
,
123
,
'int'
),
array
(
'smallint'
,
123
,
'int'
),
array
(
'datetime'
,
new
\DateTime
(
'2010-04-05 10:10:10'
),
'DateTime'
),
array
(
'datetime'
,
new
\DateTime
(
'2010-04-05 10:10:10'
),
'DateTime'
),
array
(
'datetimetz'
,
new
\DateTime
(
'2010-04-05 10:10:10'
),
'DateTime'
),
array
(
'datetimetz'
,
new
\DateTime
(
'2010-04-05 10:10:10'
),
'DateTime'
),
...
...
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