| @@ 74-87 (lines=14) @@ | ||
| 71 | return $this->getScalarResultOrDefault(null); |
|
| 72 | } |
|
| 73 | ||
| 74 | public function getSingleRowResult() |
|
| 75 | { |
|
| 76 | $row = $this->statement->fetch(\PDO::FETCH_BOTH); |
|
| 77 | ||
| 78 | if (false === $row) { |
|
| 79 | throw new NoResultException('Expected on result for given query.'); |
|
| 80 | } |
|
| 81 | ||
| 82 | if (false !== $this->statement->fetch()) { |
|
| 83 | throw new NonUniqueResultException('Expected only ine result for given query.'); |
|
| 84 | } |
|
| 85 | ||
| 86 | return $row; |
|
| 87 | } |
|
| 88 | ||
| 89 | public function getSingleRowOrDefault($default) |
|
| 90 | { |
|
| @@ 18-31 (lines=14) @@ | ||
| 15 | $this->statement = $statement; |
|
| 16 | } |
|
| 17 | ||
| 18 | public function getSingleScalarResult() |
|
| 19 | { |
|
| 20 | $scalar = $this->statement->fetchColumn(0); |
|
| 21 | ||
| 22 | if (false === $scalar) { |
|
| 23 | throw new NoResultException('Expected on result for given query.'); |
|
| 24 | } |
|
| 25 | ||
| 26 | if (false !== $this->statement->fetch()) { |
|
| 27 | throw new NonUniqueResultException('Expected only ine result for given query.'); |
|
| 28 | } |
|
| 29 | ||
| 30 | return $scalar; |
|
| 31 | } |
|
| 32 | ||
| 33 | public function getSingleScalarResultOrDefault($default) |
|
| 34 | { |
|