From 626e2a1db1c7a7927f54c5d00a280d3dcc72af2d Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Thu, 31 Jan 2013 15:14:23 +0000 Subject: [PATCH] Enable support of databases which name either is a reserved word or contains non-alphanumeric characters (i.e. itop-production). SVN:trunk[2595] --- core/cmdbsource.class.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index 6a1127ea0..7c86bf009 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -64,7 +64,7 @@ class CMDBSource } if (!empty($sSource)) { - if (!((bool)mysqli_query(self::$m_resDBLink, "USE $sSource"))) + if (!((bool)mysqli_query(self::$m_resDBLink, "USE `$sSource`"))) { throw new MySQLException('Could not select DB', array('host'=>$sServer, 'user'=>$sUser, 'db_name'=>$sSource)); } @@ -120,7 +120,7 @@ class CMDBSource { // In case we don't have rights to enumerate the databases // Let's try to connect directly - return @((bool)mysqli_query(self::$m_resDBLink, "USE $sSource")); + return @((bool)mysqli_query(self::$m_resDBLink, "USE `$sSource`")); } } @@ -133,7 +133,7 @@ class CMDBSource public static function SelectDB($sSource) { - if (!((bool)mysqli_query(self::$m_resDBLink, "USE $sSource"))) + if (!((bool)mysqli_query(self::$m_resDBLink, "USE `$sSource`"))) { throw new MySQLException('Could not select DB', array('db_name'=>$sSource)); }