From 4c0c9919c5b406383246eefce4f24d05077de22d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Jul 2012 21:48:03 +0200 Subject: [PATCH] Fix: escape for create command --- htdocs/core/db/mysql.class.php | 4 ++-- htdocs/core/db/mysqli.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index fd83f876f64..e78b2327fcc 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -800,8 +800,8 @@ class DoliDBMysql if (empty($collation)) $collation=$this->forcecollate; // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci - $sql = "CREATE DATABASE '".$this->escape($database)."'"; - $sql.= " DEFAULT CHARACTER SET '".$this->escape($charset)."' DEFAULT COLLATE '".$this->escape($collation)."'"; + $sql = "CREATE DATABASE `".$this->escape($database)."`"; + $sql.= " DEFAULT CHARACTER SET `".$this->escape($charset)."` DEFAULT COLLATE `".$this->escape($collation)."`"; dol_syslog($sql,LOG_DEBUG); $ret=$this->query($sql); diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index db2a4481422..7fa7b357e4a 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -794,8 +794,8 @@ class DoliDBMysqli if (empty($collation)) $collation=$this->forcecollate; // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci - $sql = "CREATE DATABASE '".$this->escape($database)."'"; - $sql.= " DEFAULT CHARACTER SET '".$this->escape($charset)."' DEFAULT COLLATE '".$this->escape($collation)."'"; + $sql = "CREATE DATABASE `".$this->escape($database)."`"; + $sql.= " DEFAULT CHARACTER SET `".$this->escape($charset)."` DEFAULT COLLATE `".$this->escape($collation)."`"; dol_syslog($sql,LOG_DEBUG); $ret=$this->query($sql);