Amélioration gestion erreur

This commit is contained in:
Laurent Destailleur 2007-09-15 19:36:18 +00:00
parent 22a8f302cd
commit 136e5cfc3f
4 changed files with 153 additions and 144 deletions

View File

@ -21,7 +21,7 @@
*/ */
/** /**
\file htdocs/install/etape1.php \file htdocs/install/etape0.php
\brief Permet d'afficher et de confirmer le charset par rapport aux informations précédentes -> sélection suite à connexion' \brief Permet d'afficher et de confirmer le charset par rapport aux informations précédentes -> sélection suite à connexion'
\version $Revision$ \version $Revision$
*/ */
@ -221,6 +221,9 @@ if ($db->connected)
</tr> </tr>
<?php <?php
} }
?>
</table>
<?php
} }
else else
{ {
@ -241,9 +244,6 @@ else
} }
} }
?>
</table>
<?php
pFooter($error,$setuplang); pFooter($error,$setuplang);
?> ?>

View File

@ -85,6 +85,7 @@ class DoliDb
1007 => 'DB_ERROR_ALREADY_EXISTS', 1007 => 'DB_ERROR_ALREADY_EXISTS',
1008 => 'DB_ERROR_CANNOT_DROP', 1008 => 'DB_ERROR_CANNOT_DROP',
1025 => 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP', 1025 => 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
1044 => 'DB_ERROR_ACCESSDENIED',
1046 => 'DB_ERROR_NODBSELECTED', 1046 => 'DB_ERROR_NODBSELECTED',
1048 => 'DB_ERROR_CONSTRAINT', 1048 => 'DB_ERROR_CONSTRAINT',
1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS', 1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS',
@ -237,8 +238,11 @@ class DoliDb
//force les enregistrement en latin1 si la base est en utf8 par défaut //force les enregistrement en latin1 si la base est en utf8 par défaut
// Supprimé car plante sur mon PHP-Mysql. De plus, la base est forcement en latin1 avec // Supprimé car plante sur mon PHP-Mysql. De plus, la base est forcement en latin1 avec
// les nouvelles version de Dolibarr car forcé par l'install Dolibarr. // les nouvelles version de Dolibarr car forcé par l'install Dolibarr.
if ($this->db)
{
$this->query("SET NAMES '".$this->forcecharset."'", $this->db); $this->query("SET NAMES '".$this->forcecharset."'", $this->db);
$this->query("SET CHARACTER SET '".$this->forcecharset."'", $this->db); $this->query("SET CHARACTER SET '".$this->forcecharset."'", $this->db);
}
//print "Resultat fonction connect: ".$this->db; //print "Resultat fonction connect: ".$this->db;
return $this->db; return $this->db;
} }

View File

@ -84,6 +84,7 @@ class DoliDb
1007 => 'DB_ERROR_ALREADY_EXISTS', 1007 => 'DB_ERROR_ALREADY_EXISTS',
1008 => 'DB_ERROR_CANNOT_DROP', 1008 => 'DB_ERROR_CANNOT_DROP',
1025 => 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP', 1025 => 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
1044 => 'DB_ERROR_ACCESSDENIED',
1046 => 'DB_ERROR_NODBSELECTED', 1046 => 'DB_ERROR_NODBSELECTED',
1048 => 'DB_ERROR_CONSTRAINT', 1048 => 'DB_ERROR_CONSTRAINT',
1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS', 1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS',
@ -241,8 +242,11 @@ class DoliDb
// les nouvelles version de Dolibarr car forcé par l'install Dolibarr. // les nouvelles version de Dolibarr car forcé par l'install Dolibarr.
//$this->query('SET NAMES '.$this->forcecharset); //$this->query('SET NAMES '.$this->forcecharset);
//print "Resultat fonction connect: ".$this->db; //print "Resultat fonction connect: ".$this->db;
if ($this->db)
{
$this->query("SET NAMES '".$this->forcecharset."'", $this->db); $this->query("SET NAMES '".$this->forcecharset."'", $this->db);
$this->query("SET CHARACTER SET '".$this->forcecharset."'", $this->db); $this->query("SET CHARACTER SET '".$this->forcecharset."'", $this->db);
}
return $this->db; return $this->db;
} }

View File

@ -157,7 +157,8 @@ if (! defined('NOREQUIRETRAN'))
if (! defined('NOREQUIREDB')) if (! defined('NOREQUIREDB'))
{ {
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name); $db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
if (! $db->connected)
if ($db->error)
{ {
dolibarr_print_error($db,"host=".$conf->db->host.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error); dolibarr_print_error($db,"host=".$conf->db->host.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
exit; exit;