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
4566773b
Commit
4566773b
authored
Dec 29, 2012
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for DBAL-209
parent
74c76161
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
Connection.php
lib/Doctrine/DBAL/Connection.php
+3
-2
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+32
-0
No files found.
lib/Doctrine/DBAL/Connection.php
View file @
4566773b
...
...
@@ -577,11 +577,12 @@ class Connection implements DriverConnection
*
* @param string $sql The SQL query.
* @param array $params The query parameters.
* @param array $types Query parameter types.
* @return array
*/
public
function
fetchAll
(
$sql
,
array
$params
=
array
())
public
function
fetchAll
(
$sql
,
array
$params
=
array
()
,
$types
=
array
()
)
{
return
$this
->
executeQuery
(
$sql
,
$params
)
->
fetchAll
();
return
$this
->
executeQuery
(
$sql
,
$params
,
$types
)
->
fetchAll
();
}
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
4566773b
...
...
@@ -186,6 +186,38 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertEquals
(
'foo'
,
$row
[
'test_string'
]);
}
/**
* @group DBAL-209
*/
public
function
testFetchAllWithTypes
()
{
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetime
=
new
\DateTime
(
$datetimeString
);
$sql
=
"SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"
;
$data
=
$this
->
_conn
->
fetchAll
(
$sql
,
array
(
1
,
$datetime
),
array
(
PDO
::
PARAM_STR
,
Type
::
DATETIME
));
$this
->
assertEquals
(
1
,
count
(
$data
));
$row
=
$data
[
0
];
$this
->
assertEquals
(
2
,
count
(
$row
));
$row
=
array_change_key_case
(
$row
,
\CASE_LOWER
);
$this
->
assertEquals
(
1
,
$row
[
'test_int'
]);
$this
->
assertEquals
(
$datetimeString
,
$row
[
'test_datetime'
]);
}
/**
* @group DBAL-209
* @expectedException \Doctrine\DBAL\DBALException
*/
public
function
testFetchAllWithMissingTypes
()
{
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetime
=
new
\DateTime
(
$datetimeString
);
$sql
=
"SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"
;
$data
=
$this
->
_conn
->
fetchAll
(
$sql
,
array
(
1
,
$datetime
));
}
public
function
testFetchBoth
()
{
$sql
=
"SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"
;
...
...
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