diff --git a/lib/system/system_data_source/database/mypdo.php b/lib/system/system_data_source/database/mypdo.php
index 3c5134b..eec2786 100755
--- a/lib/system/system_data_source/database/mypdo.php
+++ b/lib/system/system_data_source/database/mypdo.php
@@ -127,6 +127,24 @@ class mypdo extends Database
try {
$this->db_connect = new PDO("$this->dbtype:host=$this->server;port=$this->dbport;dbname=$this->dbname;charset=$this->dbcharset", "$this->user", "$this->password"); // PDO Connection
} catch (PDOException $e) {
+ // var_dump($e);
+ // echo $e->getCode();
+ // echo $e->getMessage();
+ switch($e->getCode()) {
+ case 2002:
+ echo
+ "
+ ( ! ) Connexion à la base de données impossible ! |
";
+ die();
+ // break;
+ case 1045:
+ case 1044:
+ echo
+ "
+ ( ! ) ".$e->getMessage()." |
";
+ die();
+ // break;
+ }
return false;
}
}
@@ -182,11 +200,15 @@ class mypdo extends Database
if($query != "")
{
$this->num_queries++;
- $this->query_result = $this->db_connect->prepare($query);
- if( !$data )
+
+ $this->query_result = $this->db_connect->prepare($query);
+
+ if( !$data )
$this->query_result->execute();
else
$this->query_result->execute($data);
+ } else {
+ $this->sql_error();
}
if(isset($this->query_result))
{
@@ -477,8 +499,9 @@ class mypdo extends Database
*/
function sql_error($query_id = 0)
{
- $result["message"] = @mysql_error($this->db_connect);
- $result["code"] = @mysql_errno($this->db_connect);
+ // $result["message"] = @mysql_error($this->db_connect);
+ // $result["code"] = @mysql_errno($this->db_connect);
+ $result = $this->db_connect->errorInfo();
return $result;
}
}