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] 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() *