mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
executeQuery()사용사 query id를 module에 국한하지 않고 addon/widget에서도 사용할 수 있도록 수정.
queryid가 a.b 일 경우 a모듈의 b쿼리를, a.b.c일 경우 a를 modules/addons/widgets로 구분하고 각 구성요소의 b/queries/c 쿼리를 실행하도록 변경. ./widgets/newest_documents/queries/getNewestDocuments.xml 참조 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2375 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
7b25690362
commit
59b2878587
2 changed files with 26 additions and 6 deletions
|
|
@ -185,10 +185,20 @@
|
|||
function executeQuery($query_id, $args = NULL) {
|
||||
if(!$query_id) return new Object(-1, 'msg_invalid_queryid');
|
||||
|
||||
list($module, $id) = explode('.',$query_id);
|
||||
if(!$module || !$id) return new Object(-1, 'msg_invalid_queryid');
|
||||
$id_args = explode('.', $query_id);
|
||||
if(count($id_args)==2) {
|
||||
$target = 'modules';
|
||||
$module = $id_args[0];
|
||||
$id = $id_args[1];
|
||||
} elseif(count($id_args)==3) {
|
||||
$target = $id_args[0];
|
||||
if(!in_array($target, array('addons','widgets'))) return;
|
||||
$module = $id_args[1];
|
||||
$id = $id_args[2];
|
||||
}
|
||||
if(!$target || !$module || !$id) return new Object(-1, 'msg_invalid_queryid');
|
||||
|
||||
$xml_file = sprintf('./modules/%s/queries/%s.xml', $module, $id);
|
||||
$xml_file = sprintf('./%s/%s/queries/%s.xml', $target, $module, $id);
|
||||
if(!file_exists($xml_file)) return new Object(-1, 'msg_invalid_queryid');
|
||||
|
||||
// 일단 cache 파일을 찾아본다
|
||||
|
|
|
|||
|
|
@ -20,7 +20,17 @@
|
|||
if(!$xml_obj) return;
|
||||
unset($buff);
|
||||
|
||||
list($module, $id) = explode('.',$query_id);
|
||||
$id_args = explode('.', $query_id);
|
||||
if(count($id_args)==2) {
|
||||
$target = 'modules';
|
||||
$module = $id_args[0];
|
||||
$id = $id_args[1];
|
||||
} elseif(count($id_args)==3) {
|
||||
$target = $id_args[0];
|
||||
if(!in_array($target, array('modules','addons','widgets'))) return;
|
||||
$module = $id_args[1];
|
||||
$id = $id_args[2];
|
||||
}
|
||||
|
||||
// insert, update, delete, select등의 action
|
||||
$action = strtolower($xml_obj->query->attrs->action);
|
||||
|
|
@ -39,12 +49,12 @@
|
|||
$output->tables[$table_name] = $alias;
|
||||
|
||||
// 테이블을 찾아서 컬럼의 속성을 구함
|
||||
$table_file = sprintf('./modules/%s/schemas/%s.xml', $module, $table_name);
|
||||
$table_file = sprintf('./%s/%s/schemas/%s.xml', 'modules', $module, $table_name);
|
||||
if(!file_exists($table_file)) {
|
||||
$searched_list = FileHandler::readDir('./modules');
|
||||
$searched_count = count($searched_list);
|
||||
for($i=0;$i<$searched_count;$i++) {
|
||||
$table_file = sprintf('./modules/%s/schemas/%s.xml', $searched_list[$i], $table_name);
|
||||
$table_file = sprintf('./%s/%s/schemas/%s.xml', 'modules', $searched_list[$i], $table_name);
|
||||
if(file_exists($table_file)) break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue