#345 die on connection failure to not disclose dbinfo, enable QQ & QP error TODO reports
This commit is contained in:
parent
1ceb562ab4
commit
240205b9b1
@ -28,11 +28,11 @@ class ConnectionMYS extends ConnectionAbstr {
|
||||
public function __construct(DBInfo $dbinfo, $new_link = false, $client_flag = 0){
|
||||
$this->connection = @mysqli_connect($dbinfo->m_host, $dbinfo->m_user, $dbinfo->m_password, $new_link, $client_flag);
|
||||
if(!$this->connection){
|
||||
throw new \Exception('Could not connect to Database. Check ur Database Settings');}
|
||||
die('Could not connect to Database. Check ur Database Settings');}
|
||||
|
||||
if(!mysqli_select_db($this->connection, $dbinfo->m_database)){
|
||||
mysqli_close($this->connection);
|
||||
throw new \Exception('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));}
|
||||
die('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));}
|
||||
|
||||
\mysqli_set_charset($this->connection, 'utf8');
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ class ConnectionPG extends ConnectionAbstr {
|
||||
$this->connection = pg_connect("host=".$dbinfo->m_host." port=".$dbinfo->m_port." dbname=".$dbinfo->m_database."
|
||||
user=".$dbinfo->m_user." password=".$dbinfo->m_password."");
|
||||
if(!$this->connection){
|
||||
throw new \Exception('Could not connect to Database. Check ur Database Settings');}
|
||||
die('Could not connect to Database. Check ur Database Settings');}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -27,7 +27,7 @@ class ConnectionSQLite extends ConnectionAbstr {
|
||||
$error = null;
|
||||
$this->connection = new \SQLite3($dbinfo->m_database);
|
||||
if(!$this->connection){
|
||||
throw new \Exception('Could not connect to Database. Check ur Database Settings: '.$error);}
|
||||
die('Could not connect to Database. Check ur Database Settings: '.$error);}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -45,7 +45,7 @@ class QP {
|
||||
return $con->prepare(static::get_class(),static::sqlite(),$params, \is_callable(static::get_class().'::types') ? static::types() : null);
|
||||
}
|
||||
} catch (\Exception $e){
|
||||
throw new \Exception(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);}
|
||||
throw new \SYSTEM\LOG\ERROR(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);}
|
||||
throw new \Exception('Could not understand Database Settings. Check ur Database Settings');
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class QQ {
|
||||
return $con->query(static::sqlite());
|
||||
}
|
||||
} catch (\Exception $e){
|
||||
throw new \Exception(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);}
|
||||
throw new \SYSTEM\LOG\ERROR(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);}
|
||||
|
||||
throw new \Exception('Could not understand Database Settings. Check ur Database Settings');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user