mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +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;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$index = $last_index;
|
||||
$step = $last_index !== 0 ? -1 : 1;
|
||||
|
||||
while ($row = $stmt->fetchObject())
|
||||
try
|
||||
{
|
||||
$result[$index] = $row;
|
||||
$index += $step;
|
||||
$result = array();
|
||||
$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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue