Errormessage fix for Connections, since they might be written to db - could result in loop
This commit is contained in:
parent
a9cf661f4d
commit
ec04a9bd83
@ -18,7 +18,7 @@ class Connection extends ConnectionAbstr{
|
|||||||
$this->connection = new \SYSTEM\DB\ConnectionPG($dbinfo);
|
$this->connection = new \SYSTEM\DB\ConnectionPG($dbinfo);
|
||||||
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoMYS){
|
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoMYS){
|
||||||
$this->connection = new \SYSTEM\DB\ConnectionMYS($dbinfo);
|
$this->connection = new \SYSTEM\DB\ConnectionMYS($dbinfo);
|
||||||
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoAMQP){
|
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoAMQP){
|
||||||
$this->connection = new \SYSTEM\DB\ConnectionAMQP($dbinfo);
|
$this->connection = new \SYSTEM\DB\ConnectionAMQP($dbinfo);
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception('Could not understand Database Settings. Check ur Database Settings');}
|
throw new \Exception('Could not understand Database Settings. Check ur Database Settings');}
|
||||||
|
|||||||
@ -11,11 +11,11 @@ class ConnectionMYS extends ConnectionAbstr {
|
|||||||
|
|
||||||
$this->connection = @mysqli_connect($dbinfo->m_host, $dbinfo->m_user, $dbinfo->m_password, $new_link, $client_flag);
|
$this->connection = @mysqli_connect($dbinfo->m_host, $dbinfo->m_user, $dbinfo->m_password, $new_link, $client_flag);
|
||||||
if(!$this->connection){
|
if(!$this->connection){
|
||||||
throw new \SYSTEM\LOG\ERROR('Could not connect to Database. Check ur Database Settings');}
|
throw new \Exception('Could not connect to Database. Check ur Database Settings');}
|
||||||
|
|
||||||
if(!mysqli_select_db($this->connection, $dbinfo->m_database)){
|
if(!mysqli_select_db($this->connection, $dbinfo->m_database)){
|
||||||
mysqli_close($this->connection);
|
mysqli_close($this->connection);
|
||||||
throw new \SYSTEM\LOG\ERROR('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));}
|
throw new \Exception('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct(){
|
public function __destruct(){
|
||||||
|
|||||||
@ -13,7 +13,7 @@ class ConnectionPG extends ConnectionAbstr {
|
|||||||
$this->connection = pg_connect("host=".$dbinfo->m_host." port=".$dbinfo->m_port." dbname=".$dbinfo->m_database."
|
$this->connection = pg_connect("host=".$dbinfo->m_host." port=".$dbinfo->m_port." dbname=".$dbinfo->m_database."
|
||||||
user=".$dbinfo->m_user." password=".$dbinfo->m_password."");
|
user=".$dbinfo->m_user." password=".$dbinfo->m_password."");
|
||||||
if(!$this->connection){
|
if(!$this->connection){
|
||||||
throw new \SYSTEM\LOG\ERROR('Could not connect to Database. Check ur Database Settings');}
|
throw new \Exception('Could not connect to Database. Check ur Database Settings');}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct(){}
|
public function __destruct(){}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user