API
9 months ago
Exception
2 years ago
Middleware
2 years ago
AbstractException.php
2 years ago
AbstractMySQLDriver.php
9 months ago
Connection.php
2 years ago
Exception.php
2 years ago
FetchUtils.php
2 years ago
Middleware.php
2 years ago
Result.php
2 years ago
ServerInfoAwareConnection.php
2 years ago
Statement.php
2 years ago
index.php
2 years ago
FetchUtils.php
40 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\DBAL\Driver; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | final class FetchUtils |
| 6 | { |
| 7 | public static function fetchOne(Result $result) |
| 8 | { |
| 9 | $row = $result->fetchNumeric(); |
| 10 | if ($row === \false) { |
| 11 | return \false; |
| 12 | } |
| 13 | return $row[0]; |
| 14 | } |
| 15 | public static function fetchAllNumeric(Result $result) : array |
| 16 | { |
| 17 | $rows = []; |
| 18 | while (($row = $result->fetchNumeric()) !== \false) { |
| 19 | $rows[] = $row; |
| 20 | } |
| 21 | return $rows; |
| 22 | } |
| 23 | public static function fetchAllAssociative(Result $result) : array |
| 24 | { |
| 25 | $rows = []; |
| 26 | while (($row = $result->fetchAssociative()) !== \false) { |
| 27 | $rows[] = $row; |
| 28 | } |
| 29 | return $rows; |
| 30 | } |
| 31 | public static function fetchFirstColumn(Result $result) : array |
| 32 | { |
| 33 | $rows = []; |
| 34 | while (($row = $result->fetchOne()) !== \false) { |
| 35 | $rows[] = $row; |
| 36 | } |
| 37 | return $rows; |
| 38 | } |
| 39 | } |
| 40 |