From eb86abff94406ec08766462f57ba2209341d2876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 05:47:17 +0100 Subject: [PATCH 01/11] Database: factorized jdate() --- htdocs/core/db/DoliDB.class.php | 19 +++++++++++++++++-- htdocs/core/db/mssql.class.php | 17 ----------------- htdocs/core/db/mysql.class.php | 17 ----------------- htdocs/core/db/mysqli.class.php | 17 ----------------- htdocs/core/db/pgsql.class.php | 17 ----------------- htdocs/core/db/sqlite.class.php | 18 ------------------ 6 files changed, 17 insertions(+), 88 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 6f5a75b35ab..7d6afd22457 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -64,8 +64,6 @@ abstract class DoliDB implements Database public $ok; public $error; - - /** * Define sort criteria of request * @@ -94,5 +92,22 @@ abstract class DoliDB implements Database return ''; } } + + /** + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 19700101020000 -> 3600 with TZ+1 and gmt=0 + * 19700101020000 -> 7200 whaterver is TZ if gmt=1 + * + * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) + * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return date Date TMS + */ + function jdate($string, $gm=false) + { + $string=preg_replace('/([^0-9])/i','',$string); + $tmp=$string.'000000'; + $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm); + return $date; + } } diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 0e1b1a2ca0c..ae8e6ea5ce6 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -553,23 +553,6 @@ class DoliDBMssql extends DoliDB return dol_print_date($param,"%Y-%m-%d %H:%M:%S"); } - /** - * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return date Date TMS - */ - function jdate($string, $gm=false) - { - $string=preg_replace('/([^0-9])/i','',$string); - $tmp=$string.'000000'; - $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm); - return $date; - } - /** * Format a SQL IF * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 46b16113a26..bd6c2794b17 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -531,23 +531,6 @@ class DoliDBMysql extends DoliDB return dol_print_date($param,"%Y%m%d%H%M%S"); } - /** - * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return date Date TMS - */ - function jdate($string, $gm=false) - { - $string=preg_replace('/([^0-9])/i','',$string); - $tmp=$string.'000000'; - $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm); - return $date; - } - /** * Format a SQL IF * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index ece1ff86532..f530656cc7f 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -541,23 +541,6 @@ class DoliDBMysqli extends DoliDB return dol_print_date($param,"%Y%m%d%H%M%S"); } - /** - * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return date Date TMS - */ - function jdate($string, $gm=false) - { - $string=preg_replace('/([^0-9])/i','',$string); - $tmp=$string.'000000'; - $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm); - return $date; - } - /** * Format a SQL IF * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index aa31f5616c8..7b2961e623c 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -752,23 +752,6 @@ class DoliDBPgsql extends DoliDB return dol_print_date($param,"%Y-%m-%d %H:%M:%S"); } - /** - * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return date Date TMS - */ - function jdate($string, $gm=false) - { - $string=preg_replace('/([^0-9])/i','',$string); - $tmp=$string.'000000'; - $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm); - return $date; - } - /** * Format a SQL IF * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 36f583011e4..67dc9593042 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -674,24 +674,6 @@ class DoliDBSqlite extends DoliDB return dol_print_date($param,"%Y%m%d%H%M%S"); } - /** - * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return date Date TMS - */ - function jdate($string, $gm=false) - { - $string=preg_replace('/([^0-9])/i','',$string); - $tmp=$string.'000000'; - $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm); - return $date; - } - - /** * Format a SQL IF * From 64fbefdb7cb6df9fcebcf0ea46fc83575c8524a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 05:54:13 +0100 Subject: [PATCH 02/11] Database: factorized ifsql() --- htdocs/core/db/DoliDB.class.php | 13 +++++++++++++ htdocs/core/db/mssql.class.php | 14 -------------- htdocs/core/db/mysql.class.php | 14 -------------- htdocs/core/db/mysqli.class.php | 13 ------------- htdocs/core/db/sqlite.class.php | 14 -------------- 5 files changed, 13 insertions(+), 55 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 7d6afd22457..c7e08e69a6e 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -64,6 +64,19 @@ abstract class DoliDB implements Database public $ok; public $error; + /** + * Format a SQL IF + * + * @param string $test Test string (example: 'cd.statut=0', 'field IS NULL') + * @param string $resok resultat si test egal + * @param string $resko resultat si test non egal + * @return string SQL string + */ + function ifsql($test,$resok,$resko) + { + return 'IF('.$test.','.$resok.','.$resko.')'; + } + /** * Define sort criteria of request * diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index ae8e6ea5ce6..5d3f9b449ce 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -553,20 +553,6 @@ class DoliDBMssql extends DoliDB return dol_print_date($param,"%Y-%m-%d %H:%M:%S"); } - /** - * Format a SQL IF - * - * @param string $test Test string (example: 'cd.statut=0', 'field IS NULL') - * @param string $resok resultat si test egal - * @param string $resko resultat si test non egal - * @return string SQL string - */ - function ifsql($test,$resok,$resko) - { - return 'IF('.$test.','.$resok.','.$resko.')'; - } - - /** * Return last request executed with query() * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index bd6c2794b17..4ce71647c4a 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -531,20 +531,6 @@ class DoliDBMysql extends DoliDB return dol_print_date($param,"%Y%m%d%H%M%S"); } - /** - * Format a SQL IF - * - * @param string $test Test string (example: 'cd.statut=0', 'field IS NULL') - * @param string $resok resultat si test egal - * @param string $resko resultat si test non egal - * @return string SQL string - */ - function ifsql($test,$resok,$resko) - { - return 'IF('.$test.','.$resok.','.$resko.')'; - } - - /** * Return last request executed with query() * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index f530656cc7f..4daefe3a397 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -541,19 +541,6 @@ class DoliDBMysqli extends DoliDB return dol_print_date($param,"%Y%m%d%H%M%S"); } - /** - * Format a SQL IF - * - * @param string $test Test string (example: 'cd.statut=0', 'field IS NULL') - * @param string $resok resultat si test egal - * @param string $resko resultat si test non egal - * @return string SQL string - */ - function ifsql($test,$resok,$resko) - { - return 'IF('.$test.','.$resok.','.$resko.')'; - } - /** * Return last request executed with query() diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 67dc9593042..f3c52762b0a 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -674,20 +674,6 @@ class DoliDBSqlite extends DoliDB return dol_print_date($param,"%Y%m%d%H%M%S"); } - /** - * Format a SQL IF - * - * @param string $test Test string (example: 'cd.statut=0', 'field IS NULL') - * @param string $resok resultat si test egal - * @param string $resko resultat si test non egal - * @return string SQL string - */ - function ifsql($test,$resok,$resko) - { - return 'IF('.$test.','.$resok.','.$resko.')'; - } - - /** * Renvoie la derniere requete soumise par la methode query() * From 0ab6fcaacadce50c4bb9866beab29fb94daf730c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 06:04:16 +0100 Subject: [PATCH 03/11] Database: factorized idate() --- htdocs/core/db/DoliDB.class.php | 12 ++++++++++++ htdocs/core/db/mysql.class.php | 13 ------------- htdocs/core/db/mysqli.class.php | 13 ------------- htdocs/core/db/sqlite.class.php | 12 ------------ 4 files changed, 12 insertions(+), 38 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index c7e08e69a6e..0caba62bf2d 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -77,6 +77,18 @@ abstract class DoliDB implements Database return 'IF('.$test.','.$resok.','.$resko.')'; } + /** + * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. + * Function to use to build INSERT, UPDATE or WHERE predica + * + * @param string $param Date TMS to convert + * @return string Date in a string YYYYMMDDHHMMSS + */ + function idate($param) + { + return dol_print_date($param,"%Y%m%d%H%M%S"); + } + /** * Define sort criteria of request * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 4ce71647c4a..d1d86711513 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -518,19 +518,6 @@ class DoliDBMysql extends DoliDB return addslashes($stringtoencode); } - - /** - * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. - * Function to use to build INSERT, UPDATE or WHERE predica - * - * @param string $param Date TMS to convert - * @return string Date in a string YYYYMMDDHHMMSS - */ - function idate($param) - { - return dol_print_date($param,"%Y%m%d%H%M%S"); - } - /** * Return last request executed with query() * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 4daefe3a397..f4d8d6f6a44 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -529,19 +529,6 @@ class DoliDBMysqli extends DoliDB return addslashes($stringtoencode); } - /** - * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. - * Function to use to build INSERT, UPDATE or WHERE predica - * - * @param string $param Date TMS to convert - * @return string Date in a string YYYYMMDDHHMMSS - */ - function idate($param) - { - return dol_print_date($param,"%Y%m%d%H%M%S"); - } - - /** * Return last request executed with query() * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index f3c52762b0a..4695bb15807 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -662,18 +662,6 @@ class DoliDBSqlite extends DoliDB return $this->db->quote($stringtoencode); } - /** - * Convert (by PHP) a GM Timestamp date into a PHP server TZ to insert into a date field. - * Function to use to build INSERT, UPDATE or WHERE predica - * - * @param string $param Date TMS to convert - * @return string Date in a string YYYYMMDDHHMMSS - */ - function idate($param) - { - return dol_print_date($param,"%Y%m%d%H%M%S"); - } - /** * Renvoie la derniere requete soumise par la methode query() * From 739a5661563725cb7eaae3b7d75c0b3b3438c819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 06:07:46 +0100 Subject: [PATCH 04/11] Database: factorized lasterrno() --- htdocs/core/db/DoliDB.class.php | 10 ++++++++++ htdocs/core/db/mssql.class.php | 10 ---------- htdocs/core/db/mysql.class.php | 10 ---------- htdocs/core/db/mysqli.class.php | 10 ---------- htdocs/core/db/pgsql.class.php | 10 ---------- htdocs/core/db/sqlite.class.php | 10 ---------- 6 files changed, 10 insertions(+), 50 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 0caba62bf2d..a246bb6f15c 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -89,6 +89,16 @@ abstract class DoliDB implements Database return dol_print_date($param,"%Y%m%d%H%M%S"); } + /** + * Return last error code + * + * @return string lasterrno + */ + function lasterrno() + { + return $this->lasterrno; + } + /** * Define sort criteria of request * diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 5d3f9b449ce..6f215e9d6f0 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -583,16 +583,6 @@ class DoliDBMssql extends DoliDB return $this->lasterror; } - /** - * Return last error code - * - * @return string lasterrno - */ - function lasterrno() - { - return $this->lasterrno; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index d1d86711513..7ebb8f84c16 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -548,16 +548,6 @@ class DoliDBMysql extends DoliDB return $this->lasterror; } - /** - * Return last error code - * - * @return string lasterrno - */ - function lasterrno() - { - return $this->lasterrno; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index f4d8d6f6a44..f7bb2c3515b 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -559,16 +559,6 @@ class DoliDBMysqli extends DoliDB return $this->lasterror; } - /** - * Renvoie le code derniere erreur - * - * @return string lasterrno - */ - function lasterrno() - { - return $this->lasterrno; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 7b2961e623c..5ee421b9a50 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -796,16 +796,6 @@ class DoliDBPgsql extends DoliDB return $this->lasterror; } - /** - * Renvoie le code derniere erreur - * - * @return string lasterrno - */ - function lasterrno() - { - return $this->lasterrno; - } - /** * Renvoie le code erreur generique de l'operation precedente. * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 4695bb15807..aae07cce299 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -692,16 +692,6 @@ class DoliDBSqlite extends DoliDB return $this->lasterror; } - /** - * Return last error code - * - * @return string lasterrno - */ - function lasterrno() - { - return $this->lasterrno; - } - /** * Renvoie le code erreur generique de l'operation precedente. * From f91e2ec7b2e6f712c265b4bea05ef1a95b162ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 06:17:12 +0100 Subject: [PATCH 05/11] Database: factorized begin() --- htdocs/core/db/DoliDB.class.php | 26 ++++++++++++++++++++++++++ htdocs/core/db/mysql.class.php | 27 --------------------------- htdocs/core/db/mysqli.class.php | 27 --------------------------- htdocs/core/db/sqlite.class.php | 27 --------------------------- 4 files changed, 26 insertions(+), 81 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index a246bb6f15c..054e2d8f0bc 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -99,6 +99,32 @@ abstract class DoliDB implements Database return $this->lasterrno; } + /** + * Start transaction + * + * @return int 1 if transaction successfuly opened or already opened, 0 if error + */ + function begin() + { + if (! $this->transaction_opened) + { + $ret=$this->query("BEGIN"); + if ($ret) + { + $this->transaction_opened++; + dol_syslog("BEGIN Transaction",LOG_DEBUG); + dol_syslog('',0,1); + } + return $ret; + } + else + { + $this->transaction_opened++; + dol_syslog('',0,1); + return 1; + } + } + /** * Define sort criteria of request * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 7ebb8f84c16..fc6a59726cb 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -287,33 +287,6 @@ class DoliDBMysql extends DoliDB return false; } - - /** - * Start transaction - * - * @return int 1 if transaction successfuly opened or already opened, 0 if error - */ - function begin() - { - if (! $this->transaction_opened) - { - $ret=$this->query("BEGIN"); - if ($ret) - { - $this->transaction_opened++; - dol_syslog("BEGIN Transaction",LOG_DEBUG); - dol_syslog('',0,1); - } - return $ret; - } - else - { - $this->transaction_opened++; - dol_syslog('',0,1); - return 1; - } - } - /** * Validate a database transaction * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index f7bb2c3515b..a8545532aba 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -291,33 +291,6 @@ class DoliDBMysqli extends DoliDB return false; } - - /** - * Start transaction - * - * @return int 1 if transaction successfuly opened or already opened, 0 if error - */ - function begin() - { - if (! $this->transaction_opened) - { - $ret=$this->query("BEGIN"); - if ($ret) - { - $this->transaction_opened++; - dol_syslog("BEGIN Transaction",LOG_DEBUG); - dol_syslog('',0,1); - } - return $ret; - } - else - { - $this->transaction_opened++; - dol_syslog('',0,1); - return 1; - } - } - /** * Validate a database transaction * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index aae07cce299..0bcc3308c1d 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -415,33 +415,6 @@ class DoliDBSqlite extends DoliDB return false; } - - /** - * Start transaction - * - * @return int 1 if transaction successfuly opened or already opened, 0 if error - */ - function begin() - { - if (! $this->transaction_opened) - { - $ret=$this->query("BEGIN"); - if ($ret) - { - $this->transaction_opened++; - dol_syslog("BEGIN Transaction",LOG_DEBUG); - dol_syslog('',0,1); - } - return $ret; - } - else - { - $this->transaction_opened++; - dol_syslog('',0,1); - return 1; - } - } - /** * Validate a database transaction * From 73d957f15881607cd208251a3851b74ab1329316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 06:31:38 +0100 Subject: [PATCH 06/11] Database: factorized common properties --- htdocs/core/db/DoliDB.class.php | 4 ++-- htdocs/core/db/mssql.class.php | 26 +------------------------- htdocs/core/db/mysql.class.php | 30 +----------------------------- htdocs/core/db/mysqli.class.php | 30 +----------------------------- htdocs/core/db/pgsql.class.php | 24 +----------------------- htdocs/core/db/sqlite.class.php | 30 +----------------------------- 6 files changed, 7 insertions(+), 137 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 054e2d8f0bc..2da6ad6cdda 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -35,9 +35,9 @@ abstract class DoliDB implements Database //! Database label static $label; //! Charset used to force charset when creating database - public $forcecharset; + public $forcecharset='utf8'; //! Collate used to force collate when creating database - public $forcecollate; + public $forcecollate='utf8_general_ci'; //! Min database version static $versionmin; //! Resultset of last query diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 6f215e9d6f0..2b7f28a7b60 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -30,8 +30,6 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; */ class DoliDBMssql extends DoliDB { - //! Database handler - var $db; //! Database type public $type='mssql'; //! Database label @@ -42,30 +40,8 @@ class DoliDBMssql extends DoliDB var $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value //! Version min database static $versionmin=array(2000); - //! Resultset of last request + //! Resultset of last query private $_results; - //! 1 si connecte, 0 sinon - var $connected; - //! 1 si base selectionne, 0 sinon - var $database_selected; - //! Nom base selectionnee - var $database_name; - //! Nom user base - var $database_user; - //! >=1 if a transaction is opened, 0 otherwise - var $transaction_opened; - //! Derniere requete executee - var $lastquery; - //! Derniere requete executee avec echec - var $lastqueryerror; - //! Message erreur mysql - var $lasterror; - //! Message erreur mysql - var $lasterrno; - - var $ok; - var $error; - /** * Constructor. diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index fc6a59726cb..9bea3e609d2 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -31,42 +31,14 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; */ class DoliDBMysql extends DoliDB { - //! Database handler - var $db; //! Database type public $type='mysql'; //! Database label static $label='MySQL'; - //! Charset used to force charset when creating database - var $forcecharset='utf8'; // latin1, utf8. Can't be static as it may be forced with a dynamic value - //! Collate used to force collate when creating database - var $forcecollate='utf8_general_ci'; // latin1_swedish_ci, utf8_general_ci. Can't be static as it may be forced with a dynamic value //! Version min database static $versionmin=array(4,1,0); - //! Resultset of last request + //! Resultset of last query private $_results; - //! 1 if connected, 0 else - var $connected; - //! 1 if database selected, 0 else - var $database_selected; - //! Database name selected - var $database_name; - //! Nom user base - var $database_user; - //! >=1 if a transaction is opened, 0 otherwise - var $transaction_opened; - //! Last executed request - var $lastquery; - //! Last failed executed request - var $lastqueryerror; - //! Message erreur mysql - var $lasterror; - //! Message erreur mysql - var $lasterrno; - - var $ok; - var $error; - /** * Constructor. diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index a8545532aba..73525be4d5b 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -31,42 +31,14 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; */ class DoliDBMysqli extends DoliDB { - //! Database handler - var $db; //! Database type public $type='mysqli'; //! Database label static $label='MySQL'; - //! Charset used to force charset when creating database - var $forcecharset='utf8'; // latin1, utf8. Can't be static as it may be forced with a dynamic value - //! Collate used to force collate when creating database - var $forcecollate='utf8_general_ci'; // latin1_swedish_ci, utf8_general_ci. Can't be static as it may be forced with a dynamic value //! Version min database static $versionmin=array(4,1,0); - //! Resultset of last request + //! Resultset of last query private $_results; - //! 1 if connected, 0 else - var $connected; - //! 1 if database selected, 0 else - var $database_selected; - //! Database name selected - var $database_name; - //! Nom user base - var $database_user; - //! >=1 if a transaction is opened, 0 otherwise - var $transaction_opened; - //! Last executed request - var $lastquery; - //! Last failed executed request - var $lastqueryerror; - //! Message erreur mysql - var $lasterror; - //! Message erreur mysql - var $lasterrno; - - var $ok; - var $error; - /** * Constructor. diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 5ee421b9a50..44e8b3dc274 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -34,8 +34,6 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; */ class DoliDBPgsql extends DoliDB { - //! Database handler - var $db; //! Database type public $type='pgsql'; // Name of manager //! Database label @@ -46,29 +44,9 @@ class DoliDBPgsql extends DoliDB var $forcecollate=''; // Can't be static as it may be forced with a dynamic value //! Version min database static $versionmin=array(8,4,0); // Version min database - - //! Resultset of last request + //! Resultset of last query private $_results; - var $connected; // 1 si connecte, 0 sinon - var $database_selected; // 1 si base selectionne, 0 sinon - var $database_name; //! Nom base selectionnee - var $database_user; //! Nom user base - //! >=1 if a transaction is opened, 0 otherwise - var $transaction_opened; - var $lastquery; - // Saved last error - var $lastqueryerror; - var $lasterror; - var $lasterrno; - - var $unescapeslashquot=0; // By default we do not force the unescape of \'. This is used only to process sql with mysql escaped data. - var $standard_conforming_strings=1; // Database has option standard_conforming_strings to on - - var $ok; - var $error; - - /** * Constructor. * This create an opened connexion to a database server and eventually to a database diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 0bcc3308c1d..ab6582affc5 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -31,42 +31,14 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; */ class DoliDBSqlite extends DoliDB { - //! Database handler - var $db; //! Database type public $type='sqlite'; //! Database label static $label='PDO Sqlite'; - //! Charset used to force charset when creating database - var $forcecharset='utf8'; // latin1, utf8. Can't be static as it may be forced with a dynamic value - //! Collate used to force collate when creating database - var $forcecollate='utf8_general_ci'; // latin1_swedish_ci, utf8_general_ci. Can't be static as it may be forced with a dynamic value //! Version min database static $versionmin=array(3,0,0); - //! Resultset of last request + //! Resultset of last query private $_results; - //! 1 if connected, 0 else - var $connected; - //! 1 if database selected, 0 else - var $database_selected; - //! Database name selected - var $database_name; - //! Nom user base - var $database_user; - //! >=1 if a transaction is opened, 0 otherwise - var $transaction_opened; - //! Last executed request - var $lastquery; - //! Last failed executed request - var $lastqueryerror; - //! Message erreur mysql - var $lasterror; - //! Message erreur mysql - var $lasterrno; - - var $ok; - var $error; - /** * Constructor. From 3f6b175879dee3dff45556d58d61a96730ca6dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 06:40:13 +0100 Subject: [PATCH 07/11] Database: factorized getVersionArray() --- htdocs/core/db/DoliDB.class.php | 10 ++++++++++ htdocs/core/db/mssql.class.php | 11 ----------- htdocs/core/db/mysql.class.php | 10 ---------- htdocs/core/db/mysqli.class.php | 10 ---------- htdocs/core/db/pgsql.class.php | 10 ---------- htdocs/core/db/sqlite.class.php | 10 ---------- 6 files changed, 10 insertions(+), 51 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 2da6ad6cdda..5fae6dab374 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -125,6 +125,16 @@ abstract class DoliDB implements Database } } + /** + * Return version of database server into an array + * + * @return array Version array + */ + function getVersionArray() + { + return explode('.',$this->getVersion()); + } + /** * Define sort criteria of request * diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 2b7f28a7b60..7459b4c0019 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -195,17 +195,6 @@ class DoliDBMssql extends DoliDB return $version['computed']; } - - /** - * Return version of database server into an array - * - * @return array Version array - */ - function getVersionArray() - { - return explode('.',$this->getVersion()); - } - /** * Return version of database client driver * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 9bea3e609d2..2bf0474157f 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -221,16 +221,6 @@ class DoliDBMysql extends DoliDB return mysql_get_server_info($this->db); } - /** - * Return version of database server into an array - * - * @return array Version array - */ - function getVersionArray() - { - return explode('.',$this->getVersion()); - } - /** * Return version of database client driver * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 73525be4d5b..bf9808a39e2 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -225,16 +225,6 @@ class DoliDBMysqli extends DoliDB return mysqli_get_server_info($this->db); } - /** - * Return version of database server into an array - * - * @return array Version array - */ - function getVersionArray() - { - return explode('.',$this->getVersion()); - } - /** * Return version of database client driver * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 44e8b3dc274..a284756caed 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -428,16 +428,6 @@ class DoliDBPgsql extends DoliDB return ''; } - /** - * Return version of database server into an array - * - * @return array Version array - */ - function getVersionArray() - { - return explode('.',$this->getVersion()); - } - /** * Return version of database client driver * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index ab6582affc5..a631fad8220 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -345,16 +345,6 @@ class DoliDBSqlite extends DoliDB return $row[0]; } - /** - * Return version of database server into an array - * - * @return array Version array - */ - function getVersionArray() - { - return explode('.',$this->getVersion()); - } - /** * Return version of database client driver * From e4e78bdd3e2f2ee02371efd4455b8877085bc48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 06:45:17 +0100 Subject: [PATCH 08/11] Database: factorized getLabel() --- htdocs/core/db/DoliDB.class.php | 10 ++++++++++ htdocs/core/db/mssql.class.php | 10 ---------- htdocs/core/db/mysql.class.php | 10 ---------- htdocs/core/db/mysqli.class.php | 10 ---------- htdocs/core/db/pgsql.class.php | 10 ---------- htdocs/core/db/sqlite.class.php | 9 --------- 6 files changed, 10 insertions(+), 49 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 5fae6dab374..3413e381547 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -135,6 +135,16 @@ abstract class DoliDB implements Database return explode('.',$this->getVersion()); } + /** + * Return label of manager + * + * @return string Label + */ + function getLabel() + { + return $this->label; + } + /** * Define sort criteria of request * diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 7459b4c0019..f96423b1a66 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -173,16 +173,6 @@ class DoliDBMssql extends DoliDB return $this->db; } - /** - * Return label of manager - * - * @return string Label - */ - function getLabel() - { - return $this->label; - } - /** * Return version of database server * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 2bf0474157f..4f06fb772b8 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -201,16 +201,6 @@ class DoliDBMysql extends DoliDB return $this->db; } - /** - * Return label of manager - * - * @return string Label - */ - function getLabel() - { - return $this->label; - } - /** * Return version of database server * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index bf9808a39e2..33cea437afe 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -205,16 +205,6 @@ class DoliDBMysqli extends DoliDB return $this->db; } - /** - * Return label of manager - * - * @return string Label - */ - function getLabel() - { - return $this->label; - } - /** * Return version of database server * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index a284756caed..bb14ebade32 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -402,16 +402,6 @@ class DoliDBPgsql extends DoliDB return $this->db; } - /** - * Return label of manager - * - * @return string Label - */ - function getLabel() - { - return $this->label; - } - /** * Return version of database server * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index a631fad8220..f4cf57bb9be 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -323,15 +323,6 @@ class DoliDBSqlite extends DoliDB return $this->db; } - /** - * Return label of manager - * - * @return string Label - */ - function getLabel() - { - return $this->label; - } /** * Return version of database server From f894df1d9e00fd7ec324c9c63f24f16c3151176a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 06:48:39 +0100 Subject: [PATCH 09/11] Database: factorized lastquerry() --- htdocs/core/db/DoliDB.class.php | 10 ++++++++++ htdocs/core/db/mssql.class.php | 10 ---------- htdocs/core/db/mysql.class.php | 10 ---------- htdocs/core/db/mysqli.class.php | 10 ---------- htdocs/core/db/pgsql.class.php | 11 ----------- htdocs/core/db/sqlite.class.php | 10 ---------- 6 files changed, 10 insertions(+), 51 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 3413e381547..2fcf08bd826 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -145,6 +145,16 @@ abstract class DoliDB implements Database return $this->label; } + /** + * Return last request executed with query() + * + * @return string Last query + */ + function lastquery() + { + return $this->lastquery; + } + /** * Define sort criteria of request * diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index f96423b1a66..5def132ab22 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -508,16 +508,6 @@ class DoliDBMssql extends DoliDB return dol_print_date($param,"%Y-%m-%d %H:%M:%S"); } - /** - * Return last request executed with query() - * - * @return string Last query - */ - function lastquery() - { - return $this->lastquery; - } - /** * Return last query in error * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 4f06fb772b8..553483b3994 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -443,16 +443,6 @@ class DoliDBMysql extends DoliDB return addslashes($stringtoencode); } - /** - * Return last request executed with query() - * - * @return string Last query - */ - function lastquery() - { - return $this->lastquery; - } - /** * Return last query in error * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 33cea437afe..d53334fd1fc 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -454,16 +454,6 @@ class DoliDBMysqli extends DoliDB return addslashes($stringtoencode); } - /** - * Return last request executed with query() - * - * @return string Last query - */ - function lastquery() - { - return $this->lastquery; - } - /** * Renvoie la derniere requete en erreur * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index bb14ebade32..645b79e3c00 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -723,17 +723,6 @@ class DoliDBPgsql extends DoliDB return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)'; } - - /** - * Renvoie la derniere requete soumise par la methode query() - * - * @return lastquery - */ - function lastquery() - { - return $this->lastquery; - } - /** * Renvoie la derniere requete en erreur * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index f4cf57bb9be..afd7ed88be8 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -588,16 +588,6 @@ class DoliDBSqlite extends DoliDB return $this->db->quote($stringtoencode); } - /** - * Renvoie la derniere requete soumise par la methode query() - * - * @return lastquery - */ - function lastquery() - { - return $this->lastquery; - } - /** * Return last query in error * From 7df97b7cfbdc3dcb4cd2110ce290744af33d30dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 07:11:45 +0100 Subject: [PATCH 10/11] Database: factorized lasterror() --- htdocs/core/db/DoliDB.class.php | 10 ++++++++++ htdocs/core/db/mssql.class.php | 10 ---------- htdocs/core/db/mysql.class.php | 10 ---------- htdocs/core/db/mysqli.class.php | 10 ---------- htdocs/core/db/pgsql.class.php | 10 ---------- htdocs/core/db/sqlite.class.php | 10 ---------- 6 files changed, 10 insertions(+), 50 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 2fcf08bd826..4b742029526 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -184,6 +184,16 @@ abstract class DoliDB implements Database } } + /** + * Return last error label + * + * @return string lasterror + */ + function lasterror() + { + return $this->lasterror; + } + /** * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) * 19700101020000 -> 3600 with TZ+1 and gmt=0 diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 5def132ab22..7d96d421183 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -518,16 +518,6 @@ class DoliDBMssql extends DoliDB return $this->lastqueryerror; } - /** - * Return last error label - * - * @return string lasterror - */ - function lasterror() - { - return $this->lasterror; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 553483b3994..733c6a32cdc 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -453,16 +453,6 @@ class DoliDBMysql extends DoliDB return $this->lastqueryerror; } - /** - * Return last error label - * - * @return string lasterror - */ - function lasterror() - { - return $this->lasterror; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index d53334fd1fc..636c0f24f02 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -464,16 +464,6 @@ class DoliDBMysqli extends DoliDB return $this->lastqueryerror; } - /** - * Renvoie le libelle derniere erreur - * - * @return string lasterror - */ - function lasterror() - { - return $this->lasterror; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 645b79e3c00..f70d4da652b 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -733,16 +733,6 @@ class DoliDBPgsql extends DoliDB return $this->lastqueryerror; } - /** - * Renvoie le libelle derniere erreur - * - * @return string lasterror - */ - function lasterror() - { - return $this->lasterror; - } - /** * Renvoie le code erreur generique de l'operation precedente. * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index afd7ed88be8..f1d2a3d6203 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -598,16 +598,6 @@ class DoliDBSqlite extends DoliDB return $this->lastqueryerror; } - /** - * Return last error label - * - * @return string lasterror - */ - function lasterror() - { - return $this->lasterror; - } - /** * Renvoie le code erreur generique de l'operation precedente. * From a23f6d6a85d6da0e0a3d507b70e342bf28e1bdfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 15 Mar 2014 07:20:00 +0100 Subject: [PATCH 11/11] Database: factorized lastqueryerror() --- htdocs/core/db/DoliDB.class.php | 10 ++++++++++ htdocs/core/db/mssql.class.php | 10 ---------- htdocs/core/db/mysql.class.php | 10 ---------- htdocs/core/db/mysqli.class.php | 10 ---------- htdocs/core/db/pgsql.class.php | 10 ---------- htdocs/core/db/sqlite.class.php | 10 ---------- 6 files changed, 10 insertions(+), 50 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 4b742029526..f85aa4ca78a 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -210,5 +210,15 @@ abstract class DoliDB implements Database $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm); return $date; } + + /** + * Return last query in error + * + * @return string lastqueryerror + */ + function lastqueryerror() + { + return $this->lastqueryerror; + } } diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 7d96d421183..239582a6595 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -508,16 +508,6 @@ class DoliDBMssql extends DoliDB return dol_print_date($param,"%Y-%m-%d %H:%M:%S"); } - /** - * Return last query in error - * - * @return string lastqueryerror - */ - function lastqueryerror() - { - return $this->lastqueryerror; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 733c6a32cdc..582adbb343a 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -443,16 +443,6 @@ class DoliDBMysql extends DoliDB return addslashes($stringtoencode); } - /** - * Return last query in error - * - * @return string lastqueryerror - */ - function lastqueryerror() - { - return $this->lastqueryerror; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 636c0f24f02..66fa531bf09 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -454,16 +454,6 @@ class DoliDBMysqli extends DoliDB return addslashes($stringtoencode); } - /** - * Renvoie la derniere requete en erreur - * - * @return string lastqueryerror - */ - function lastqueryerror() - { - return $this->lastqueryerror; - } - /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index f70d4da652b..5dcc5767014 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -723,16 +723,6 @@ class DoliDBPgsql extends DoliDB return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)'; } - /** - * Renvoie la derniere requete en erreur - * - * @return string lastqueryerror - */ - function lastqueryerror() - { - return $this->lastqueryerror; - } - /** * Renvoie le code erreur generique de l'operation precedente. * diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index f1d2a3d6203..fe3ac4718a9 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -588,16 +588,6 @@ class DoliDBSqlite extends DoliDB return $this->db->quote($stringtoencode); } - /** - * Return last query in error - * - * @return string lastqueryerror - */ - function lastqueryerror() - { - return $this->lastqueryerror; - } - /** * Renvoie le code erreur generique de l'operation precedente. *