mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 17:44:38 +09:00
Convert PDOException to DBError in _fetch()
This commit is contained in:
parent
3dc27f37b7
commit
afcc25bd50
1 changed files with 16 additions and 9 deletions
|
|
@ -477,17 +477,24 @@ class DB
|
||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array();
|
try
|
||||||
$index = $last_index;
|
|
||||||
$step = $last_index !== 0 ? -1 : 1;
|
|
||||||
|
|
||||||
while ($row = $stmt->fetchObject())
|
|
||||||
{
|
{
|
||||||
$result[$index] = $row;
|
$result = array();
|
||||||
$index += $step;
|
$index = $last_index;
|
||||||
|
$step = $last_index !== 0 ? -1 : 1;
|
||||||
|
|
||||||
|
while ($row = $stmt->fetchObject())
|
||||||
|
{
|
||||||
|
$result[$index] = $row;
|
||||||
|
$index += $step;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
catch (\PDOException $e)
|
||||||
|
{
|
||||||
|
throw new Exceptions\DBError($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
if ($result_type === 'auto' && $last_index === 0 && count($result) === 1)
|
if ($result_type === 'auto' && $last_index === 0 && count($result) === 1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue