File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -336,6 +336,12 @@ public function fetch(
336336 return \array_values ($ row );
337337 }
338338
339+ if ($ fetch_style === \PDO ::FETCH_COLUMN ) {
340+ $ this ->resultCursor ++;
341+
342+ return \array_values ($ row )[0 ] ?? null ;
343+ }
344+
339345 if ($ fetch_style === \PDO ::FETCH_BOTH ) {
340346 $ this ->resultCursor ++;
341347
Original file line number Diff line number Diff line change @@ -901,6 +901,17 @@ public function testFetchCountForMissingColumn(int $columnIndex)
901901 $ query ->fetchColumn ($ columnIndex );
902902 }
903903
904+ public function testFetchWithColumnMode ()
905+ {
906+ $ pdo = self ::getConnectionToFullDB (false );
907+
908+ $ query = $ pdo ->prepare ('SELECT `id` FROM `video_game_characters` WHERE id=2 LIMIT 1 ' );
909+
910+ $ query ->execute ();
911+
912+ self ::assertEquals (2 , $ query ->fetch (\PDO ::FETCH_COLUMN ));
913+ }
914+
904915 public function dataProviderTruncateForms (): \Generator
905916 {
906917 foreach ([
You can’t perform that action at this time.
0 commit comments