Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHuang committed Mar 29, 2019
1 parent 5a8cceb commit 9fb5391
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/Model/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,34 @@ public function reconnect()
$this->__construct($this->config);
}


/**
* @param $query
*
* @return bool|\PDOStatement
* @return bool|false|\PDOStatement
*/
public function query($query)
{
try {
return parent::query($query);
return $this->pdo->query($query);
} catch (Exception $e) {
$this->reconnect();

return parent::query($query);
return $this->pdo->query($query);
}
}

/**
* @param $query
*
* @return bool|int
*
* @throws \ErrorException
*/
public function exec($query)
{
try {
return parent::exec($query);
return $this->pdo->exec($query);
} catch (Exception $e) {
$this->reconnect();

return parent::exec($query);
return $this->pdo->exec($query);
}
}

Expand Down

0 comments on commit 9fb5391

Please sign in to comment.