Merge branch 'pr/703' into develop

This commit is contained in:
bnu 2015-03-23 14:37:07 +09:00
commit 256c68a4ee
2 changed files with 9 additions and 7 deletions

View file

@ -546,7 +546,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();
@ -600,7 +600,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
@ -643,10 +643,12 @@ 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))
{ {
return new Object(-1, 'msg_invalid_queryid'); return new Object(-1, 'msg_invalid_queryid');
@ -683,7 +685,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;
} }

View file

@ -133,7 +133,7 @@ class commentModel extends comment
{ {
$args = new stdClass(); $args = new stdClass();
$args->comment_srl = $comment_srl; $args->comment_srl = $comment_srl;
$output = executeQuery('comment.getChildCommentCount', $args); $output = executeQuery('comment.getChildCommentCount', $args, NULL, 'master');
return (int) $output->data->count; return (int) $output->data->count;
} }
@ -146,7 +146,7 @@ class commentModel extends comment
{ {
$args = new stdClass(); $args = new stdClass();
$args->comment_srl = $comment_srl; $args->comment_srl = $comment_srl;
$output = executeQueryArray('comment.getChildComments', $args); $output = executeQueryArray('comment.getChildComments', $args, NULL, 'master');
return $output->data; return $output->data;
} }
@ -255,7 +255,7 @@ class commentModel extends comment
$args->status = 1; $args->status = 1;
} }
$output = executeQuery('comment.getCommentCount', $args); $output = executeQuery('comment.getCommentCount', $args, NULL, 'master');
$total_count = $output->data->count; $total_count = $output->data->count;
return (int) $total_count; return (int) $total_count;