merge from 1.5.3 (~r10943)

git-svn-id: http://xe-core.googlecode.com/svn/trunk@10951 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-07-27 02:47:10 +00:00
parent 7aa4798373
commit 54e3a72065
334 changed files with 13011 additions and 5561 deletions

View file

@ -1,13 +1,12 @@
<?php
/**
* @class XmlQueryParser
* @author NHN (developers@xpressengine.com)
* @brief case to parse XE xml query
* @version 0.1
* XmlQueryParser
* Case to parse XE xml query
*
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @todo need to support extend query such as subquery, union
**/
*/
class XmlQueryParser extends XmlParser {
var $default_list = array();
@ -15,13 +14,13 @@
var $filter_list = array();
/**
* @brief parse a xml query file and save the result as a new file specified by cache_file
* @param[in] $query_id name of query
* @param[in] $xml_file file path of a xml query file to be loaded
* @param[in] $cache_file file path of a cache file to store resultant php code after parsing xml query
* @return Nothing is requred.
* @remarks {there should be a way to report an error}
**/
* Parse a xml query file and save the result as a new file specified by cache_file
* {there should be a way to report an error}
* @param string $query_id name of query
* @param string $xml_file file path of a xml query file to be loaded
* @param string $cache_file file path of a cache file to store resultant php code after parsing xml query
* @return void Nothing is requred.
*/
function parse($query_id, $xml_file, $cache_file) {
// query xml 파일을 찾아서 파싱, 결과가 없으면 return
$buff = FileHandler::readFile($xml_file);
@ -36,7 +35,8 @@
$id = $id_args[1];
} elseif(count($id_args)==3) {
$target = $id_args[0];
if(!in_array($target, array('modules','addons','widgets'))) return;
$typeList = array('modules'=>1, 'addons'=>1, 'widgets'=>1);
if(!isset($typeList[$target])) return;
$module = $id_args[1];
$id = $id_args[2];
}
@ -53,6 +53,7 @@
if(!$tables) return;
if(!is_array($tables)) $tables = array($tables);
$joinList = array('left join'=>1, 'left outer join'=>1, 'right join'=>1, 'right outer join'=>1);
foreach($tables as $key => $val) {
// 테이블과 alias의 이름을 구함
@ -62,7 +63,7 @@
$output->tables[$alias] = $table_name;
if(in_array($val->attrs->type,array('left join','left outer join','right join','right outer join')) && count($val->conditions)){
if(isset($joinList[$val->attrs->type]) && count($val->conditions)){
$output->left_tables[$alias] = $val->attrs->type;
$left_conditions[$alias] = $val->conditions;
}
@ -260,11 +261,10 @@
}
/**
* @brief transfer given column information to object->columns
* @param[in] column information
* @result Returns $object
* Transfer given column information to object->columns
* @param array $columns column information
* @return object
*/
function _setColumn($columns){
if(!$columns) {
$output->column[] = array("*" => "*");
@ -296,9 +296,9 @@
}
/**
* @brief transfer condition information to $object->conditions
* @param[in] SQL condition information
* @result Returns $output
* Transfer condition information to $object->conditions
* @param object @condition SQL condition information
* @retrun object
*/
function _setConditions($conditions){
// 조건절 정리
@ -339,9 +339,9 @@
}
/**
* @brief transfer condition information to $object->groups
* @param[in] SQL group information
* @result Returns $output
* Transfer condition information to $object->groups
* @param array $group_list SQL group information
* @return object
*/
function _setGroup($group_list){
// group 정리
@ -361,9 +361,9 @@
/**
* @brief transfer pagnation information to $output
* @param[in] $xml_obj xml object containing Navigation information
* @result Returns $output
* Transfer pagnation information to $output
* @param object $xml_obj xml object containing Navigation information
* @return object
*/
function _setNavigation($xml_obj){
$navigation = $xml_obj->query->navigation;
@ -389,10 +389,10 @@
}
/**
* @brief retrieve column information from $output->colums to generate corresponding php code
* @param[in] $column
* @remarks the name of this method is misleading.
* @result Returns string buffer containing php code
* Retrieve column information from $output->colums to generate corresponding php code <br />
* The name of this method is misleading.
* @param array $columns
* @return string buffer containing php code
*/
function _getColumn($columns){
$buff = '';
@ -439,10 +439,10 @@
}
/**
* @brief retrieve condition information from $output->condition to generate corresponding php code
* @param[in] $conditions array containing Query conditions
* @remarks the name of this method is misleading.
* @return Returns string buffer containing php code
* Retrieve condition information from $output->condition to generate corresponding php code
* The name of this method is misleading.
* @param array $conditions array containing Query conditions
* @return string buffer containing php code
*/
function _getConditions($conditions){
$buff = '';
@ -472,21 +472,30 @@
return $buff;
}
/**
* Add argument to $this->args
* @param mixed $args_name argument value
* @return void
*/
function addArguments($args_name)
{
$this->args[] = $args_name;
}
/**
* Get argument from $this->args
* @return mixed
*/
function getArguments()
{
return $this->args;
}
/**
* @brief returns predefined default values correspoding to given parameters
* @param[in] $name
* @param[in] $value
* @return Returns a default value for specified field
* Returns predefined default values correspoding to given parameters
* @param string $name
* @param mixed $value
* @return mixed Returns a default value for specified field
*/
function getDefault($name, $value) {
$db_info = Context::getDBInfo ();