diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 849f6ea3a..af6f2f01d 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -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 * @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(); @@ -600,7 +600,7 @@ class DB // look for cache 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(); // execute query @@ -643,9 +643,11 @@ class DB * @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 */ - function _executeQuery($cache_file, $source_args, $query_id, $arg_columns) + function _executeQuery($cache_file, $source_args, $query_id, $arg_columns, $type) { global $lang; + + if(!in_array($type, array('master','slave'))) $type = 'slave'; if(!file_exists($cache_file)) { @@ -683,7 +685,7 @@ class DB case 'select' : $arg_columns = is_array($arg_columns) ? $arg_columns : array(); $output->setColumnList($arg_columns); - $connection = $this->_getConnection('slave'); + $connection = $this->_getConnection($type); $output = $this->_executeSelectAct($output, $connection); break; } diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index 93e26a7d1..01a483738 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -133,7 +133,7 @@ class commentModel extends comment { $args = new stdClass(); $args->comment_srl = $comment_srl; - $output = executeQuery('comment.getChildCommentCount', $args); + $output = executeQuery('comment.getChildCommentCount', $args, NULL, 'master'); return (int) $output->data->count; } @@ -146,7 +146,7 @@ class commentModel extends comment { $args = new stdClass(); $args->comment_srl = $comment_srl; - $output = executeQueryArray('comment.getChildComments', $args); + $output = executeQueryArray('comment.getChildComments', $args, NULL, 'master'); return $output->data; } @@ -255,7 +255,7 @@ class commentModel extends comment $args->status = 1; } - $output = executeQuery('comment.getCommentCount', $args); + $output = executeQuery('comment.getCommentCount', $args, NULL, 'master'); $total_count = $output->data->count; return (int) $total_count;