@@ -102,13 +102,13 @@ public function testMixingFetch() : void
102
102
$ numExpectedResult [] = array_values ($ v );
103
103
}
104
104
105
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
105
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
106
106
107
107
$ data = $ this ->hydrateStmt ($ stmt , FetchMode::ASSOCIATIVE );
108
108
109
109
self ::assertEquals ($ this ->expectedResult , $ data );
110
110
111
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
111
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
112
112
113
113
$ data = $ this ->hydrateStmt ($ stmt , FetchMode::NUMERIC );
114
114
@@ -124,26 +124,26 @@ public function testIteratorFetch() : void
124
124
125
125
private function assertStandardAndIteratorFetchAreEqual (int $ fetchMode ) : void
126
126
{
127
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
127
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
128
128
$ data = $ this ->hydrateStmt ($ stmt , $ fetchMode );
129
129
130
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
130
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
131
131
$ dataIterator = $ this ->hydrateStmtIterator ($ stmt , $ fetchMode );
132
132
133
133
self ::assertEquals ($ data , $ dataIterator );
134
134
}
135
135
136
136
public function testDontCloseNoCache () : void
137
137
{
138
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
138
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
139
139
140
140
$ data = [];
141
141
142
142
while ($ row = $ stmt ->fetch (FetchMode::ASSOCIATIVE )) {
143
143
$ data [] = $ row ;
144
144
}
145
145
146
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
146
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
147
147
148
148
$ data = [];
149
149
@@ -156,12 +156,12 @@ public function testDontCloseNoCache() : void
156
156
157
157
public function testDontFinishNoCache () : void
158
158
{
159
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
159
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
160
160
161
161
$ stmt ->fetch (FetchMode::ASSOCIATIVE );
162
162
$ stmt ->closeCursor ();
163
163
164
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
164
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
165
165
166
166
$ this ->hydrateStmt ($ stmt , FetchMode::NUMERIC );
167
167
@@ -171,7 +171,7 @@ public function testDontFinishNoCache() : void
171
171
public function testFetchAllAndFinishSavesCache () : void
172
172
{
173
173
$ layerCache = new ArrayCache ();
174
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' , $ layerCache ));
174
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' , $ layerCache ));
175
175
$ stmt ->fetchAll ();
176
176
$ stmt ->closeCursor ();
177
177
@@ -199,13 +199,13 @@ public function testFetchAllColumn() : void
199
199
*/
200
200
private function assertCacheNonCacheSelectSameFetchModeAreEqual (array $ expectedResult , int $ fetchMode ) : void
201
201
{
202
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
202
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
203
203
204
204
self ::assertEquals (2 , $ stmt ->columnCount ());
205
205
$ data = $ this ->hydrateStmt ($ stmt , $ fetchMode );
206
206
self ::assertEquals ($ expectedResult , $ data );
207
207
208
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (10 , 'testcachekey ' ));
208
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching ORDER BY test_int ASC ' , [], [], new QueryCacheProfile (0 , 'testcachekey ' ));
209
209
210
210
self ::assertEquals (2 , $ stmt ->columnCount ());
211
211
$ data = $ this ->hydrateStmt ($ stmt , $ fetchMode );
@@ -215,23 +215,24 @@ private function assertCacheNonCacheSelectSameFetchModeAreEqual(array $expectedR
215
215
216
216
public function testEmptyResultCache () : void
217
217
{
218
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (10 , 'emptycachekey ' ));
219
- $ data = $ this ->hydrateStmt ($ stmt );
218
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (0 , 'emptycachekey ' ));
219
+ $ this ->hydrateStmt ($ stmt );
220
220
221
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (10 , 'emptycachekey ' ));
222
- $ data = $ this ->hydrateStmt ($ stmt );
221
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (0 , 'emptycachekey ' ));
222
+ $ this ->hydrateStmt ($ stmt );
223
223
224
224
self ::assertCount (1 , $ this ->sqlLogger ->queries , 'just one dbal hit ' );
225
225
}
226
226
227
227
public function testChangeCacheImpl () : void
228
228
{
229
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (10 , 'emptycachekey ' ));
230
- $ data = $ this ->hydrateStmt ($ stmt );
229
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (0 , 'emptycachekey ' ));
230
+ $ this ->hydrateStmt ($ stmt );
231
231
232
232
$ secondCache = new ArrayCache ();
233
- $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (10 , 'emptycachekey ' , $ secondCache ));
234
- $ data = $ this ->hydrateStmt ($ stmt );
233
+
234
+ $ stmt = $ this ->connection ->executeQuery ('SELECT * FROM caching WHERE test_int > 500 ' , [], [], new QueryCacheProfile (0 , 'emptycachekey ' , $ secondCache ));
235
+ $ this ->hydrateStmt ($ stmt );
235
236
236
237
self ::assertCount (2 , $ this ->sqlLogger ->queries , 'two hits ' );
237
238
self ::assertCount (1 , $ secondCache ->fetch ('emptycachekey ' ));
@@ -243,7 +244,8 @@ public function testChangeCacheImpl() : void
243
244
private function hydrateStmt (ResultStatement $ stmt , int $ fetchMode = FetchMode::ASSOCIATIVE ) : array
244
245
{
245
246
$ data = [];
246
- while ($ row = $ stmt ->fetch ($ fetchMode )) {
247
+
248
+ foreach ($ stmt ->fetchAll ($ fetchMode ) as $ row ) {
247
249
$ data [] = is_array ($ row ) ? array_change_key_case ($ row , CASE_LOWER ) : $ row ;
248
250
}
249
251
0 commit comments