mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
reverse merge from 1.6.0 (r10156, r10469, r10370, r10369, r10365, r10111, r10110, r10108, r10064, r10063, r10060, r10054, r10052, r10051, r10050, r10049, r10044, r10042, r10041, r10030, r10029, r10024, r10014, r10013)
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10715 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3afad81016
commit
57a0cc59b1
24 changed files with 258 additions and 77 deletions
|
|
@ -21,6 +21,7 @@
|
|||
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
||||
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/SelectColumnTag.class.php');
|
||||
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnTag.class.php');
|
||||
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnTagWithoutArgument.class.php');
|
||||
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/UpdateColumnTag.class.php');
|
||||
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/SelectColumnsTag.class.php');
|
||||
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnsTag.class.php');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* @class InsertColumnTagWithoutArgument
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file whose action is 'insert-select'
|
||||
*
|
||||
**/
|
||||
|
||||
class InsertColumnTagWithoutArgument extends ColumnTag {
|
||||
|
||||
function InsertColumnTagWithoutArgument($column) {
|
||||
parent::ColumnTag($column->attrs->name);
|
||||
$dbParser = DB::getParser();
|
||||
$this->name = $dbParser->parseColumnName($this->name);
|
||||
}
|
||||
|
||||
function getExpressionString(){
|
||||
return sprintf('new Expression(\'%s\')', $this->name);
|
||||
}
|
||||
|
||||
function getArgument(){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
foreach($xml_columns as $column){
|
||||
if($column->name === 'query') $this->columns[] = new QueryTag($column, true);
|
||||
else if(!isset($column->attrs->var) && !isset($column->attrs->default)) $this->columns[] = new InsertColumnTagWithoutArgument($column);
|
||||
else $this->columns[] = new InsertColumnTag($column);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@
|
|||
if($this->name == '*') return "new StarExpression()";
|
||||
if($this->click_count)
|
||||
return sprintf('new ClickCountExpression(%s, %s, $args->%s)', $this->name, $this->alias,$this->click_count);
|
||||
if(strpos($this->name, '$') === 0)
|
||||
return sprintf('new SelectExpression($args->%s)', substr($this->name, 1));
|
||||
$dbParser = DB::getParser();
|
||||
return sprintf('new SelectExpression(\'%s\'%s)', $this->name, $this->alias ? ', \''.$dbParser->escape($this->alias) .'\'': '');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class QueryTag {
|
|||
//xml tags
|
||||
var $columns;
|
||||
var $tables;
|
||||
var $subquery;
|
||||
var $conditions;
|
||||
var $groups;
|
||||
var $navigation;
|
||||
|
|
@ -37,9 +38,12 @@ class QueryTag {
|
|||
$this->getColumns();
|
||||
$tables = $this->getTables();
|
||||
$this->setTableColumnTypes($tables);
|
||||
$this->getSubquery(); // Used for insert-select
|
||||
$this->getConditions();
|
||||
$this->getGroups();
|
||||
$this->getNavigation();
|
||||
|
||||
|
||||
$this->getPrebuff();
|
||||
$this->getBuff();
|
||||
}
|
||||
|
|
@ -77,19 +81,20 @@ class QueryTag {
|
|||
}
|
||||
}
|
||||
|
||||
function getColumns() {
|
||||
if ($this->action == 'select') {
|
||||
return $this->columns = new SelectColumnsTag($this->query->columns);
|
||||
} else if ($this->action == 'insert') {
|
||||
return $this->columns = new InsertColumnsTag($this->query->columns->column);
|
||||
} else if ($this->action == 'update') {
|
||||
return $this->columns = new UpdateColumnsTag($this->query->columns->column);
|
||||
} else if ($this->action == 'delete') {
|
||||
return $this->columns = null;
|
||||
function getColumns(){
|
||||
if($this->action == 'select'){
|
||||
return $this->columns = new SelectColumnsTag($this->query->columns);
|
||||
}else if($this->action == 'insert' || $this->action == 'insert-select'){
|
||||
return $this->columns = new InsertColumnsTag($this->query->columns->column);
|
||||
}else if($this->action == 'update') {
|
||||
return $this->columns = new UpdateColumnsTag($this->query->columns->column);
|
||||
}else if($this->action == 'delete') {
|
||||
return $this->columns = null;
|
||||
}
|
||||
}
|
||||
|
||||
function getPrebuff() {
|
||||
if($this->isSubQuery) return;
|
||||
// TODO Check if this work with arguments in join clause
|
||||
$arguments = $this->getArguments();
|
||||
|
||||
|
|
@ -159,11 +164,13 @@ class QueryTag {
|
|||
if ($this->columns)
|
||||
$buff .= '$query->setColumns(' . $this->columns->toString() . ');' . PHP_EOL;
|
||||
|
||||
$buff .= '$query->setTables(' . $this->tables->toString() . ');' . PHP_EOL;
|
||||
$buff .= '$query->setConditions(' . $this->conditions->toString() . ');' . PHP_EOL;
|
||||
$buff .= '$query->setGroups(' . $this->groups->toString() . ');' . PHP_EOL;
|
||||
$buff .= '$query->setOrder(' . $this->navigation->getOrderByString() . ');' . PHP_EOL;
|
||||
$buff .= '$query->setLimit(' . $this->navigation->getLimitString() . ');' . PHP_EOL;
|
||||
$buff .= '$query->setTables(' . $this->tables->toString() .');'.PHP_EOL;
|
||||
if($this->action == 'insert-select')
|
||||
$buff .= '$query->setSubquery(' . $this->subquery->toString() .');'.PHP_EOL;
|
||||
$buff .= '$query->setConditions('.$this->conditions->toString() .');'.PHP_EOL;
|
||||
$buff .= '$query->setGroups(' . $this->groups->toString() . ');'.PHP_EOL;
|
||||
$buff .= '$query->setOrder(' . $this->navigation->getOrderByString() .');'.PHP_EOL;
|
||||
$buff .= '$query->setLimit(' . $this->navigation->getLimitString() .');'.PHP_EOL;
|
||||
|
||||
$this->buff = $buff;
|
||||
return $this->buff;
|
||||
|
|
@ -176,7 +183,13 @@ class QueryTag {
|
|||
return $this->tables = new TablesTag($this->query->tables);
|
||||
}
|
||||
|
||||
function getConditions() {
|
||||
function getSubquery(){
|
||||
if($this->query->query){
|
||||
$this->subquery = new QueryTag($this->query->query, true);
|
||||
}
|
||||
}
|
||||
|
||||
function getConditions(){
|
||||
return $this->conditions = new ConditionsTag($this->query->conditions);
|
||||
}
|
||||
|
||||
|
|
@ -207,11 +220,13 @@ class QueryTag {
|
|||
return $this->buff;
|
||||
}
|
||||
|
||||
function getArguments() {
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
if ($this->columns)
|
||||
$arguments = array_merge($arguments, $this->columns->getArguments());
|
||||
$arguments = array_merge($arguments, $this->tables->getArguments());
|
||||
if($this->action =='insert-select')
|
||||
$arguments = array_merge($arguments, $this->subquery->getArguments());
|
||||
$arguments = array_merge($arguments, $this->tables->getArguments());
|
||||
$arguments = array_merge($arguments, $this->conditions->getArguments());
|
||||
$arguments = array_merge($arguments, $this->navigation->getArguments());
|
||||
return $arguments;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue