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
abbedeca
Commit
abbedeca
authored
May 22, 2017
by
Ian Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check query is only run once during iteration.
parent
689200e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
RewindableGenerator.php
lib/Doctrine/DBAL/RewindableGenerator.php
+1
-3
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+12
-1
No files found.
lib/Doctrine/DBAL/RewindableGenerator.php
View file @
abbedeca
...
@@ -16,8 +16,6 @@ class RewindableGenerator implements \IteratorAggregate
...
@@ -16,8 +16,6 @@ class RewindableGenerator implements \IteratorAggregate
public
function
getIterator
()
public
function
getIterator
()
{
{
$g
=
$this
->
generator
;
return
(
$this
->
generator
)();
return
$g
();
}
}
}
}
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
abbedeca
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
Doctrine\Tests\DBAL\Functional
;
namespace
Doctrine\Tests\DBAL\Functional
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Logging\DebugStack
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
;
use
PDO
;
use
PDO
;
...
@@ -869,7 +870,11 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -869,7 +870,11 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
public
function
testIteratorCanBeIteratedMultipleTimes
()
public
function
testIteratorCanBeIteratedMultipleTimes
()
{
{
$sql
=
"SELECT test_int, test_string FROM fetch_table"
;
$preTestLogger
=
$this
->
_conn
->
getConfiguration
()
->
getSQLLogger
();
$stack
=
new
DebugStack
();
$this
->
_conn
->
getConfiguration
()
->
setSQLLogger
(
$stack
);
$sql
=
'SELECT test_int, test_string FROM fetch_table'
;
$stmt
=
$this
->
_conn
->
query
(
$sql
);
$stmt
=
$this
->
_conn
->
query
(
$sql
);
$stmt
->
setFetchMode
(
\PDO
::
FETCH_ASSOC
);
$stmt
->
setFetchMode
(
\PDO
::
FETCH_ASSOC
);
...
@@ -884,6 +889,12 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -884,6 +889,12 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
}
$this
->
assertEquals
(
$i
,
$j
);
$this
->
assertEquals
(
$i
,
$j
);
// Check only 1 query is run.
$this
->
assertCount
(
1
,
$stack
->
queries
);
// Reset the SQL logger
$this
->
_conn
->
getConfiguration
()
->
setSQLLogger
(
$preTestLogger
);
}
}
}
}
...
...
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