mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-03 23:52:24 +01:00
Fix: Gestion d'erreur sur l'chec de connexion base
This commit is contained in:
@@ -465,10 +465,17 @@ class DoliDb
|
|||||||
|
|
||||||
function errno()
|
function errno()
|
||||||
{
|
{
|
||||||
if (isset($this->errorcode_map[mysql_errno($this->db)])) {
|
if (! $this->connected) {
|
||||||
return $this->errorcode_map[mysql_errno($this->db)];
|
// Si il y a eu echec de connection, $this->db n'est pas valide.
|
||||||
|
return 'DB_ERROR_FAILED_TO_CONNECT';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Si il y a eu echec de connection, $this->db n'est pas valide.
|
||||||
|
if (isset($this->errorcode_map[mysql_errno($this->db)])) {
|
||||||
|
return $this->errorcode_map[mysql_errno($this->db)];
|
||||||
|
}
|
||||||
|
return 'DB_ERROR_'.mysql_errno($this->db);
|
||||||
}
|
}
|
||||||
return 'DB_ERROR_'.mysql_errno($this->db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -478,7 +485,13 @@ class DoliDb
|
|||||||
|
|
||||||
function error()
|
function error()
|
||||||
{
|
{
|
||||||
return mysql_error($this->db);
|
if (! $this->connected) {
|
||||||
|
// Si il y a eu echec de connection, $this->db n'est pas valide pour mysql_error.
|
||||||
|
return 'Not connected. Check setup parameters in conf/conf.php file';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return mysql_error($this->db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user