From 02c7587226f44a4155b4c2a34e9f8da56b5d2fb2 Mon Sep 17 00:00:00 2001 From: ucorina Date: Thu, 8 Sep 2011 14:57:31 +0000 Subject: [PATCH] issue 157 - Updated code so that no queries will execute when DB is not set and removed default escape char hack. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9129 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/db/DB.class.php | 10 ++++------ modules/install/install.controller.php | 2 -- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index df03ac2ab..dda455029 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -75,6 +75,8 @@ var $cache_file = 'files/cache/queries/'; ///< location of query cache + var $db_type; ///< stores database type: 'mysql','cubrid','mssql' etc. or 'db' when database is not yet set + /** * @brief returns instance of certain db type * @param[in] $db_type type of db @@ -93,6 +95,7 @@ // get a singletone instance of the database driver class require_once($class_file); $GLOBALS['__DB__'][$db_type] = call_user_func(array($class_name, 'create')); + $GLOBALS['__DB__'][$db_type]->db_type = $db_type; } return $GLOBALS['__DB__'][$db_type]; @@ -323,6 +326,7 @@ **/ function executeQuery($query_id, $args = NULL, $arg_columns = NULL, $database_type = 'master') { if(!$query_id) return new Object(-1, 'msg_invalid_queryid'); + if(!$this->db_type) return; $this->actDBClassStart(); @@ -601,12 +605,6 @@ return "INSERT INTO $tableName \n $values"; } - // HACK This is needed because on installation, the XmlQueryParer is used without any configured database - // TODO Change this or make sure the query cache files created before db.config exists are deleted - function getParser(){ - return new DBParser('`'); - } - function _getSlaveConnectionStringIndex() { $max = count($this->slave_db); $indx = rand(0, $max - 1); diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index f70ee75a7..da20fcf5a 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -166,8 +166,6 @@ Context::setDBInfo($db_info); // Create DB Instance $oDB = &DB::getInstance(); - // Force update dbParser - XmlQueryParser::getDBParser(true); // Check if available to connect to the DB if(!$oDB->isConnected()) return $oDB->getError(); // When installing firebire DB, transaction will not be used