Merge 1.5.2.3 (~r10623)

git-svn-id: http://xe-core.googlecode.com/svn/trunk@10624 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-04-26 09:17:29 +00:00
parent 79fdf10866
commit e4306a789f
915 changed files with 71076 additions and 245 deletions

View file

@ -4,13 +4,15 @@
var $queryTag;
function QueryParser($query, $isSubQuery = false) {
$this->queryTag = new QueryTag($query, $isSubQuery);
function QueryParser($query = NULL, $isSubQuery = false) {
if ($query)
$this->queryTag = new QueryTag($query, $isSubQuery);
}
function getTableInfo($query_id, $table_name) {
$column_type = array();
$module = '';
$id_args = explode('.', $query_id);
if (count($id_args) == 2) {
$target = 'modules';
@ -22,7 +24,7 @@
return;
$module = $id_args[1];
$id = $id_args[2];
}
}
// get column properties from the table
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
@ -62,4 +64,4 @@
}
?>
?>

View file

@ -17,7 +17,6 @@
function createConditionValue(){
if(!isset($this->value)) return;
$name = $this->column_name;
$operation = $this->operation;
$value = $this->value;
@ -98,4 +97,4 @@
}
?>
?>

View file

@ -58,7 +58,7 @@
//if($str_pos===false) return $this->value;
$func_name = substr($this->value, 0, $str_pos);
$args = substr($this->value, $str_pos+1, strlen($value)-1);
$args = substr($this->value, $str_pos+1, -1);
switch($func_name) {
case 'ipaddress' :
@ -106,5 +106,3 @@
return $this->value;
}
}
?>

View file

@ -90,7 +90,7 @@ class QueryArgument {
$arg = sprintf("\n" . '${\'%s_argument\'} = new Argument(\'%s\', %s);' . "\n"
, $this->argument_name
, $this->variable_name
, $this->ignore_value ? 'null' : '$args->' . $this->variable_name);
, $this->ignore_value ? 'null' : '$args->{\'' . $this->variable_name . '\'}');
$arg .= $this->argument_validator->toString();

View file

@ -12,15 +12,20 @@
var $click_count;
function SelectColumnTag($column){
parent::ColumnTag($column->attrs->name);
if(!$this->name) $this->name = "*";
if($this->name != "*") {
$dbParser = DB::getParser();
$this->name = $dbParser->parseExpression($this->name);
if ($column == "*" || $column->attrs->name == '*')
{
parent::ColumnTag(NULL);
$this->name = "*";
}
else
{
parent::ColumnTag($column->attrs->name);
$dbParser = new DB(); $dbParser = &$dbParser->getParser();
$this->name = $dbParser->parseExpression($this->name);
$this->alias = $column->attrs->alias;
$this->click_count = $column->attrs->click_count;
$this->alias = $column->attrs->alias;
$this->click_count = $column->attrs->click_count;
}
}
function getExpressionString(){
@ -31,4 +36,3 @@
return sprintf('new SelectExpression(\'%s\'%s)', $this->name, $this->alias ? ', \''.$dbParser->escape($this->alias) .'\'': '');
}
}
?>

View file

@ -4,6 +4,9 @@
var $columns;
function SelectColumnsTag($xml_columns_tag){
if (!$xml_columns_tag)
$xml_columns_tag = new Xml_Node_();
$xml_columns = $xml_columns_tag->column;
$xml_queries = $xml_columns_tag->query;
@ -54,4 +57,4 @@
return $arguments;
}
}
?>
?>

View file

@ -107,4 +107,4 @@
}
}
}
?>
?>

View file

@ -4,6 +4,8 @@
function ConditionsTag($xml_conditions){
$this->condition_groups = array();
if (!$xml_conditions)
return;
$xml_condition_list = array();
if($xml_conditions->condition)
@ -45,4 +47,4 @@
return $arguments;
}
}
?>
?>

View file

@ -9,7 +9,7 @@
if($xml_groups) {
if(!is_array($xml_groups)) $xml_groups = array($xml_groups);
$dbParser = DB::getParser();
$dbParser = &DB::getParser();
for($i=0;$i<count($xml_groups);$i++) {
$group = $xml_groups[$i];
$column = trim($group->attrs->column);
@ -32,4 +32,4 @@
}
}
?>
?>

View file

@ -11,7 +11,7 @@
$this->argument_name = $index->attrs->var;
// Sort index - column by which to sort
//$dbParser = DB::getParser();
//$dbParser = new DB(); $dbParser = &$dbParser->getParser();
//$index->attrs->default = $dbParser->parseExpression($index->attrs->default);
$this->default = $index->attrs->default;
$this->argument = new QueryArgument($index);
@ -19,6 +19,8 @@
// Sort order - asc / desc
$this->sort_order = $index->attrs->order;
if(!in_array($this->sort_order, array("asc", "desc"))){
$arg = new Xml_Node_();
$arg->attrs = new Xml_Node_();
$arg->attrs->var = $this->sort_order;
$arg->attrs->default = 'asc';
$this->sort_order_argument = new SortQueryArgument($arg);

View file

@ -7,7 +7,7 @@
var $list_count;
function LimitTag($index){
if($index->page->attrs && $index->page_count->attrs){
if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs){
$this->page = new QueryArgument($index->page);
$this->page_count = new QueryArgument($index->page_count);
$this->arguments[] = $this->page;

View file

@ -15,19 +15,19 @@
foreach($order as $order_info) {
$this->order[] = new IndexTag($order_info);
}
}
if($xml_navigation->page->attrs || $xml_navigation->list_count->attrs)
if($xml_navigation->page && $xml_navigation->page->attrs || $xml_navigation->list_count && $xml_navigation->list_count->attrs)
$this->limit = new LimitTag($xml_navigation);
$list_count = $xml_navigation->list_count->attrs;
$this->list_count = $list_count;
if ($xml_navigation->list_count)
$this->list_count = $xml_navigation->list_count->attrs;
$page_count = $xml_navigation->page_count->attrs;
$this->page_count = $page_count;
if ($xml_navigation->page_count)
$this->page_count = $xml_navigation->page_count->attrs;
$page = $xml_navigation->page->attrs;
$this->page = $page ;
if ($xml_navigation->page)
$this->page = $xml_navigation->page->attrs;
}
}
}
@ -56,4 +56,4 @@
}
}
?>
?>

View file

@ -104,7 +104,8 @@ class QueryTag {
$table_alias = $argument->getTableName();
if(isset($table_alias))
{
$column_type = $this->column_type[$this->getQueryId()][$table_alias][$argument->getColumnName()];
if (isset($this->column_type[$this->getQueryId()][$table_alias][$argument->getColumnName()]))
$column_type = $this->column_type[$this->getQueryId()][$table_alias][$argument->getColumnName()];
}
else
{
@ -112,7 +113,7 @@ class QueryTag {
$column_name = $argument->getColumnName();
foreach($current_tables as $current_table)
{
if($current_table[$column_name])
if(isset($current_table[$column_name]))
$column_type = $current_table[$column_name];
}
}
@ -169,7 +170,7 @@ class QueryTag {
}
function getTables() {
if ($this->query->index_hint->attrs->for == 'ALL' || Context::getDBType() == strtolower($this->query->index_hint->attrs->for))
if($this->query->index_hint && ($this->query->index_hint->attrs->for == 'ALL' || Context::getDBType() == strtolower($this->query->index_hint->attrs->for)))
return $this->tables = new TablesTag($this->query->tables, $this->query->index_hint);
else
return $this->tables = new TablesTag($this->query->tables);
@ -180,7 +181,10 @@ class QueryTag {
}
function getGroups() {
return $this->groups = new GroupsTag($this->query->groups->group);
if ($this->query->groups)
return $this->groups = new GroupsTag($this->query->groups->group);
else
return $this->groups = new GroupsTag(NULL);
}
function getNavigation() {

View file

@ -25,7 +25,7 @@
$dbType = ucfirst(Context::getDBType());
$result = sprintf('new %sTableWithHint(\'%s\'%s, array('
, $dbType
, $dbType == 'Mysqli' ? 'Mysql' : $dbType
, $dbParser->escape($this->name)
, $this->alias ? ', \'' . $dbParser->escape($this->alias) .'\'' : ', null'
//, ', \'' . $dbParser->escape($this->index->name) .'\', \'' . $this->index->type .'\''
@ -45,4 +45,4 @@
}
}
?>
?>

View file

@ -68,6 +68,7 @@
*/
function getTableString(){
$dbParser = DB::getParser();
if($this->isJoinTable()){
return sprintf('new JoinTable(\'%s\', \'%s\', "%s", %s)'
, $dbParser->escape($this->name)
@ -85,4 +86,4 @@
}
}
?>
?>

View file

@ -29,8 +29,9 @@
$index_nodes = $xml_index_hints_tag->index;
if(!is_array($index_nodes)) $index_nodes = array($index_nodes);
foreach($index_nodes as $index_node) {
if(!$indexes[$index_node->attrs->table]) $indexes[$index_node->attrs->table] = array();
if(!isset($indexes[$index_node->attrs->table])) $indexes[$index_node->attrs->table] = array();
$count = count($indexes[$index_node->attrs->table]);
$indexes[$index_node->attrs->table][$count] = (object) NULL;
$indexes[$index_node->attrs->table][$count]->name = $index_node->attrs->name;
$indexes[$index_node->attrs->table][$count]->type = $index_node->attrs->type;
}
@ -41,7 +42,7 @@
$this->tables[] = new QueryTag($tag, true);
}
else {
if($indexes && $indexes[$tag->attrs->name])
if(isset($indexes) && $indexes && isset($indexes[$tag->attrs->name]))
$this->tables[] = new HintTableTag($tag, $indexes[$tag->attrs->name]);
else
$this->tables[] = new TableTag($tag);
@ -73,4 +74,4 @@
return $arguments;
}
}
?>
?>