Update DB.class.php

This commit is contained in:
Soonjae Kim 2014-05-13 13:45:10 +09:00
parent c9e711c94a
commit fd745953d8

View file

@ -552,7 +552,7 @@ class DB
* @param array $arg_columns column list. if you want get specific colums from executed result, add column list to $arg_columns * @param array $arg_columns column list. if you want get specific colums from executed result, add column list to $arg_columns
* @return object result of query * @return object result of query
*/ */
function executeQuery($query_id, $args = NULL, $arg_columns = NULL) function executeQuery($query_id, $args = NULL, $arg_columns = NULL, $type = NULL)
{ {
static $cache_file = array(); static $cache_file = array();
@ -606,7 +606,7 @@ class DB
// look for cache file // look for cache file
$cache_file[$query_id] = $this->checkQueryCacheFile($query_id, $xml_file); $cache_file[$query_id] = $this->checkQueryCacheFile($query_id, $xml_file);
} }
$result = $this->_executeQuery($cache_file[$query_id], $args, $query_id, $arg_columns); $result = $this->_executeQuery($cache_file[$query_id], $args, $query_id, $arg_columns, $type);
$this->actDBClassFinish(); $this->actDBClassFinish();
// execute query // execute query
@ -649,9 +649,11 @@ class DB
* @param array $arg_columns column list. if you want get specific colums from executed result, add column list to $arg_columns * @param array $arg_columns column list. if you want get specific colums from executed result, add column list to $arg_columns
* @return object result of query * @return object result of query
*/ */
function _executeQuery($cache_file, $source_args, $query_id, $arg_columns) function _executeQuery($cache_file, $source_args, $query_id, $arg_columns, $type)
{ {
global $lang; global $lang;
if(!in_array($type, array('master','slave'))) $type = 'slave';
if(!file_exists($cache_file)) if(!file_exists($cache_file))
{ {
@ -689,7 +691,7 @@ class DB
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('slave'); $connection = $this->_getConnection($type);
$output = $this->_executeSelectAct($output, $connection); $output = $this->_executeSelectAct($output, $connection);
break; break;
} }