@@ -81,15 +81,10 @@ class DatabaseInterface implements DbalInterface
8181{
8282 public static self |null $ instance = null ;
8383
84- /**
85- * Force STORE_RESULT method, ignored by classic MySQL.
86- */
87- public const QUERY_BUFFERED = 0 ;
88-
8984 /**
9085 * Do not read all rows immediately.
9186 */
92- public const QUERY_UNBUFFERED = 2 ;
87+ public const QUERY_UNBUFFERED = true ;
9388
9489 /**
9590 * Get session variable.
@@ -165,20 +160,13 @@ public static function getInstance(): self
165160 return self ::$ instance ;
166161 }
167162
168- /**
169- * runs a query
170- *
171- * @param string $query SQL query to execute
172- * @param int $options optional query options
173- * @param bool $cacheAffectedRows whether to cache affected rows
174- */
175163 public function query (
176164 string $ query ,
177165 ConnectionType $ connectionType = ConnectionType::User,
178- int $ options = self :: QUERY_BUFFERED ,
166+ bool $ unbuffered = false ,
179167 bool $ cacheAffectedRows = true ,
180168 ): ResultInterface {
181- $ result = $ this ->tryQuery ($ query , $ connectionType , $ options , $ cacheAffectedRows );
169+ $ result = $ this ->tryQuery ($ query , $ connectionType , $ unbuffered , $ cacheAffectedRows );
182170
183171 if (! $ result ) {
184172 Generator::mysqlDie ($ this ->getError ($ connectionType ), $ query );
@@ -192,19 +180,10 @@ public function getCache(): Cache
192180 return $ this ->cache ;
193181 }
194182
195- /**
196- * runs a query and returns the result
197- *
198- * @param string $query query to run
199- * @param int $options if DatabaseInterface::QUERY_UNBUFFERED
200- * is provided, it will instruct the extension
201- * to use unbuffered mode
202- * @param bool $cacheAffectedRows whether to cache affected row
203- */
204183 public function tryQuery (
205184 string $ query ,
206185 ConnectionType $ connectionType = ConnectionType::User,
207- int $ options = self :: QUERY_BUFFERED ,
186+ bool $ unbuffered = false ,
208187 bool $ cacheAffectedRows = true ,
209188 ): ResultInterface |false {
210189 if (! isset ($ this ->connections [$ connectionType ->value ])) {
@@ -213,7 +192,7 @@ public function tryQuery(
213192
214193 $ time = microtime (true );
215194
216- $ result = $ this ->extension ->realQuery ($ query , $ this ->connections [$ connectionType ->value ], $ options );
195+ $ result = $ this ->extension ->realQuery ($ query , $ this ->connections [$ connectionType ->value ], $ unbuffered );
217196
218197 if ($ connectionType === ConnectionType::User) {
219198 $ this ->lastQueryExecutionTime = microtime (true ) - $ time ;
@@ -288,7 +267,7 @@ public function queryAsControlUser(string $sql): ResultInterface
288267 // is called for tracking purposes but we want to display the correct number
289268 // of rows affected by the original query, not by the query generated for
290269 // tracking.
291- return $ this ->query ($ sql , ConnectionType::ControlUser, self :: QUERY_BUFFERED , false );
270+ return $ this ->query ($ sql , ConnectionType::ControlUser, cacheAffectedRows: false );
292271 }
293272
294273 /**
@@ -305,7 +284,7 @@ public function tryQueryAsControlUser(string $sql): ResultInterface|false
305284 // is called for tracking purposes but we want to display the correct number
306285 // of rows affected by the original query, not by the query generated for
307286 // tracking.
308- return $ this ->tryQuery ($ sql , ConnectionType::ControlUser, self :: QUERY_BUFFERED , false );
287+ return $ this ->tryQuery ($ sql , ConnectionType::ControlUser, cacheAffectedRows: false );
309288 }
310289
311290 /**
@@ -1195,7 +1174,7 @@ public function fetchValue(
11951174 int |string $ field = 0 ,
11961175 ConnectionType $ connectionType = ConnectionType::User,
11971176 ): string |false |null {
1198- $ result = $ this ->tryQuery ($ query , $ connectionType , self :: QUERY_BUFFERED , false );
1177+ $ result = $ this ->tryQuery ($ query , $ connectionType , cacheAffectedRows: false );
11991178 if ($ result === false ) {
12001179 return false ;
12011180 }
@@ -1224,7 +1203,7 @@ public function fetchSingleRow(
12241203 string $ type = DbalInterface::FETCH_ASSOC ,
12251204 ConnectionType $ connectionType = ConnectionType::User,
12261205 ): array |null {
1227- $ result = $ this ->tryQuery ($ query , $ connectionType , self :: QUERY_BUFFERED , false );
1206+ $ result = $ this ->tryQuery ($ query , $ connectionType , cacheAffectedRows: false );
12281207 if ($ result === false ) {
12291208 return null ;
12301209 }
@@ -1315,7 +1294,7 @@ public function fetchResult(
13151294 ): array {
13161295 $ resultRows = [];
13171296
1318- $ result = $ this ->tryQuery ($ query , $ connectionType , self :: QUERY_BUFFERED , false );
1297+ $ result = $ this ->tryQuery ($ query , $ connectionType , cacheAffectedRows: false );
13191298
13201299 // return empty array if result is empty or false
13211300 if ($ result === false ) {
@@ -1397,7 +1376,7 @@ public function getCompatibilities(): array
13971376 */
13981377 public function getWarnings (ConnectionType $ connectionType = ConnectionType::User): array
13991378 {
1400- $ result = $ this ->tryQuery ('SHOW WARNINGS ' , $ connectionType , 0 , false );
1379+ $ result = $ this ->tryQuery ('SHOW WARNINGS ' , $ connectionType , cacheAffectedRows: false );
14011380 if ($ result === false ) {
14021381 return [];
14031382 }
0 commit comments