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
56e6c00e
Commit
56e6c00e
authored
Jan 16, 2012
by
Fabio B. Silva
Committed by
Benjamin Eberlei
Jan 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DBAL-196
parent
5aa35aa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
+38
-4
Statement.php
lib/Doctrine/DBAL/Statement.php
+4
-4
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+34
-0
No files found.
lib/Doctrine/DBAL/Statement.php
View file @
56e6c00e
...
...
@@ -203,13 +203,13 @@ class Statement implements \IteratorAggregate, DriverStatement
* Returns an array containing all of the result set rows.
*
* @param integer $fetchStyle
* @param
integer $columnIndex
* @param
mixed $fetchArgument
* @return array An array containing all of the remaining rows in the result set.
*/
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
,
$
columnIndex
=
0
)
public
function
fetchAll
(
$fetchStyle
=
PDO
::
FETCH_BOTH
,
$
fetchArgument
=
null
)
{
if
(
$
columnIndex
!=
0
)
{
return
$this
->
stmt
->
fetchAll
(
$fetchStyle
,
$
columnIndex
);
if
(
$
fetchArgument
!==
null
)
{
return
$this
->
stmt
->
fetchAll
(
$fetchStyle
,
$
fetchArgument
);
}
return
$this
->
stmt
->
fetchAll
(
$fetchStyle
);
}
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
56e6c00e
...
...
@@ -380,4 +380,38 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$row
=
array_keys
(
$stmt
->
fetch
());
$this
->
assertEquals
(
0
,
count
(
array_filter
(
$row
,
function
(
$v
)
{
return
!
is_numeric
(
$v
);
})),
"should be no non-numerical elements in the result."
);
}
/**
* @group DBAL-196
*/
public
function
testFetchAllSupportFetchClass
()
{
$this
->
_conn
->
executeQuery
(
'DELETE FROM fetch_table'
)
->
execute
();
$this
->
_conn
->
insert
(
'fetch_table'
,
array
(
'test_int'
=>
1
,
'test_string'
=>
'foo'
,
'test_datetime'
=>
'2010-01-01 10:10:10'
));
$sql
=
"SELECT test_int, test_string, test_datetime FROM fetch_table"
;
$stmt
=
$this
->
_conn
->
prepare
(
$sql
);
$stmt
->
execute
();
$results
=
$stmt
->
fetchAll
(
\PDO
::
FETCH_CLASS
,
__NAMESPACE__
.
'\\MyFetchClass'
);
$this
->
assertEquals
(
1
,
count
(
$results
));
$this
->
assertInstanceOf
(
__NAMESPACE__
.
'\\MyFetchClass'
,
$results
[
0
]);
$this
->
assertEquals
(
1
,
$results
[
0
]
->
test_int
);
$this
->
assertEquals
(
'foo'
,
$results
[
0
]
->
test_string
);
$this
->
assertEquals
(
'2010-01-01 10:10:10'
,
$results
[
0
]
->
test_datetime
);
}
}
class
MyFetchClass
{
public
$test_int
,
$test_string
,
$test_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