Changed db class to always run select queries on slave.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9141 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-09-13 10:33:20 +00:00
parent 20d589afc0
commit aa1f0ceddc

View file

@ -323,7 +323,7 @@
* @return result of query * @return result of query
* @remarks this function finds xml file or cache file of $query_id, compiles it and then execute it * @remarks this function finds xml file or cache file of $query_id, compiles it and then execute it
**/ **/
function executeQuery($query_id, $args = NULL, $arg_columns = NULL, $database_type = 'master') { function executeQuery($query_id, $args = NULL, $arg_columns = NULL) {
if(!$query_id) return new Object(-1, 'msg_invalid_queryid'); if(!$query_id) return new Object(-1, 'msg_invalid_queryid');
if(!$this->db_type) return; if(!$this->db_type) return;
@ -358,7 +358,7 @@
// look for cache file // look for cache file
$cache_file = $this->checkQueryCacheFile($query_id, $xml_file); $cache_file = $this->checkQueryCacheFile($query_id, $xml_file);
$result = $this->_executeQuery($cache_file, $args, $query_id, $arg_columns, $database_type); $result = $this->_executeQuery($cache_file, $args, $query_id, $arg_columns);
$this->actDBClassFinish(); $this->actDBClassFinish();
// execute query // execute query
@ -398,7 +398,7 @@
* @param[in] $query_id query id * @param[in] $query_id query id
* @return result of query * @return result of query
**/ **/
function _executeQuery($cache_file, $source_args, $query_id, $arg_columns, $database_type) { function _executeQuery($cache_file, $source_args, $query_id, $arg_columns) {
global $lang; global $lang;
if(!file_exists($cache_file)) return new Object(-1, 'msg_invalid_queryid'); if(!file_exists($cache_file)) return new Object(-1, 'msg_invalid_queryid');
@ -426,7 +426,7 @@
case 'select' : case 'select' :
$arg_columns = is_array($arg_columns)?$arg_columns:array(); $arg_columns = is_array($arg_columns)?$arg_columns:array();
$output->setColumnList($arg_columns); $output->setColumnList($arg_columns);
$connection = $this->_getConnection($database_type); $connection = $this->_getConnection('slave');
$output = $this->_executeSelectAct($output, $connection); $output = $this->_executeSelectAct($output, $connection);
break; break;
} }
@ -788,7 +788,7 @@
$this->elapsed_dbclass_time = $elapsed_dbclass_time; $this->elapsed_dbclass_time = $elapsed_dbclass_time;
$GLOBALS['__dbclass_elapsed_time__'] += $elapsed_dbclass_time; $GLOBALS['__dbclass_elapsed_time__'] += $elapsed_dbclass_time;
} }
/** /**
* Returns a database specific parser class * Returns a database specific parser class
* used for escaping expressions and table/column identifiers * used for escaping expressions and table/column identifiers
@ -805,7 +805,7 @@
} }
return $dbParser; return $dbParser;
} }
} }
?> ?>