mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
Remove unnecessary try/catch from DB connection
This commit is contained in:
parent
07110829e7
commit
fdca261133
1 changed files with 25 additions and 40 deletions
|
@ -19,7 +19,6 @@ class DbConnection{
|
|||
|
||||
$connectionString = 'mysql:';
|
||||
|
||||
try{
|
||||
if(stripos($host, ':') !== false){
|
||||
$port = null;
|
||||
preg_match('/([^:]*):([0-9]+)/ius', $host, $matches);
|
||||
|
@ -51,20 +50,6 @@ class DbConnection{
|
|||
// We can't use persistent connections (connection pooling) because we would have race condition problems with last_insert_id()
|
||||
$this->_link = new \PDO($connectionString, $user, $password, $params);
|
||||
}
|
||||
catch(Exception $ex){
|
||||
if(SITE_STATUS == SITE_STATUS_DEV){
|
||||
var_dump($ex);
|
||||
}
|
||||
else{
|
||||
Log::WriteErrorLogEntry('Error connecting to ' . $connectionString . '. Exception: ' . vds($ex));
|
||||
}
|
||||
|
||||
if($require){
|
||||
print("Something crazy happened in our database.");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inputs: string $sql = the SQL query to execute
|
||||
// array $params = an array of parameters to bind to the SQL statement
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue