From 0146ba83bf2428534dfd57d659320c72cbc0e56f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Jan 2010 23:53:13 +0000 Subject: [PATCH] Add test if flush fails --- htdocs/lib/databases/mysqli.lib.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/lib/databases/mysqli.lib.php b/htdocs/lib/databases/mysqli.lib.php index 8f47bf1c045..44c106b4caa 100644 --- a/htdocs/lib/databases/mysqli.lib.php +++ b/htdocs/lib/databases/mysqli.lib.php @@ -708,13 +708,13 @@ class DoliDb function encrypt($fieldorvalue, $withQuotes=0) { global $conf; - + // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); - + //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); - + $return = ($withQuotes?"'":"").addslashes($fieldorvalue).($withQuotes?"'":""); if ($cryptType && !empty($cryptKey)) @@ -740,13 +740,13 @@ class DoliDb function decrypt($value) { global $conf; - + // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); - + //Encryption key $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); - + $return = $value; if ($cryptType && !empty($cryptKey)) @@ -1037,6 +1037,10 @@ class DoliDb dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql); $resql=$this->query($sql); + if (! $resql) + { + return -1; + } return 1; }