File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -29,22 +29,27 @@ public function fetchAssociative()
2929
3030 public function fetchOne ()
3131 {
32- return $ this ->connection ->fetchRow ($ this ->result )[0 ];
32+ $ result = $ this ->connection ->fetchRow ($ this ->result );
33+ return $ result ? $ result [0 ] : false ;
3334 }
3435
3536 public function fetchAllNumeric (): array
3637 {
37- return $ this ->fetchAll ('fetchNumeric ' );
38+
39+ $ result = $ this ->connection ->fetchAll ($ this ->result ,SW_PGSQL_NUM );
40+ return $ result ? $ result : array ();
41+
3842 }
3943
4044 public function fetchAllAssociative (): array
4145 {
42- return $ this ->fetchAll ('fetchAssociative ' );
46+ $ result = $ this ->connection ->fetchAll ($ this ->result ,SW_PGSQL_ASSOC );
47+ return $ result ? $ result : array ();
4348 }
4449
4550 public function fetchFirstColumn (): array
4651 {
47- return array_column ($ this ->fetchAll ( ' fetchNumeric ' ), 0 );
52+ return array_column ($ this ->fetchAllNumeric ( ), 0 );
4853 }
4954
5055 public function rowCount (): int
@@ -62,14 +67,5 @@ public function free(): void
6267 $ this ->result = null ;
6368 }
6469
65- private function fetchAll (string $ method ): array
66- {
67- $ result_set = [];
68-
69- while ($ row = [$ this , $ method ]) {
70- $ result_set [] = $ row ;
71- }
72-
73- return $ result_set ;
74- }
70+
7571}
You can’t perform that action at this time.
0 commit comments