Use exception in ResultSet
This commit is contained in:
@ -4,6 +4,7 @@ namespace ProVM\Database;
|
|||||||
use PDO;
|
use PDO;
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
use ProVM\Concept\Database\ResultSet as RSInterface;
|
use ProVM\Concept\Database\ResultSet as RSInterface;
|
||||||
|
use ProVM\Exception\BlankResult;
|
||||||
|
|
||||||
class ResultSet implements RSInterface
|
class ResultSet implements RSInterface
|
||||||
{
|
{
|
||||||
@ -33,7 +34,7 @@ class ResultSet implements RSInterface
|
|||||||
{
|
{
|
||||||
$rs = $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $this->getStatement()->fetchAll(PDO::FETCH_ASSOC);
|
||||||
if (!$rs) {
|
if (!$rs) {
|
||||||
throw new \PDOException("No results found.");
|
throw new BlankResult();
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
@ -41,7 +42,7 @@ class ResultSet implements RSInterface
|
|||||||
{
|
{
|
||||||
$rs = $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
|
$rs = $this->getStatement()->fetchAll(PDO::FETCH_OBJ);
|
||||||
if (!$rs) {
|
if (!$rs) {
|
||||||
throw new \PDOException("No results found.");
|
throw new BlankResult();
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
@ -49,7 +50,7 @@ class ResultSet implements RSInterface
|
|||||||
{
|
{
|
||||||
$rs = $this->getStatement()->fetch(PDO::FETCH_ASSOC);
|
$rs = $this->getStatement()->fetch(PDO::FETCH_ASSOC);
|
||||||
if (!$rs or count($rs) === 0) {
|
if (!$rs or count($rs) === 0) {
|
||||||
throw new \PDOException("No results found.");
|
throw new BlankResult();
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
@ -57,7 +58,7 @@ class ResultSet implements RSInterface
|
|||||||
{
|
{
|
||||||
$rs = $this->getStatement()->fetch(PDO::FETCH_OBJ);
|
$rs = $this->getStatement()->fetch(PDO::FETCH_OBJ);
|
||||||
if (!$rs or count($rs) === 0) {
|
if (!$rs or count($rs) === 0) {
|
||||||
throw new \PDOException("No results found.");
|
throw new BlankResult();
|
||||||
}
|
}
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user