Reverted rev 10009 and 10010 related to db classes - will commit changes to 1.6.0 branch.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10012 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2012-01-05 12:08:50 +00:00
parent 1f5e256339
commit 00d2fdf2b1
8 changed files with 38 additions and 175 deletions

View file

@ -21,7 +21,6 @@
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');

View file

@ -1,27 +0,0 @@
<?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(){
var_dump($this->name);
return sprintf('new Expression(\'%s\')', $this->name);
}
function getArgument(){
return null;
}
}
?>

View file

@ -19,7 +19,6 @@
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);
}
}

View file

@ -10,7 +10,6 @@ class QueryTag {
//xml tags
var $columns;
var $tables;
var $subquery;
var $conditions;
var $groups;
var $navigation;
@ -38,12 +37,9 @@ 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();
}
@ -82,7 +78,7 @@ class QueryTag {
function getColumns(){
if($this->action == 'select'){
return $this->columns = new SelectColumnsTag($this->query->columns);
}else if($this->action == 'insert' || $this->action == 'insert-select'){
}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);
@ -92,7 +88,6 @@ class QueryTag {
}
function getPrebuff(){
if($this->isSubQuery) return;
// TODO Check if this work with arguments in join clause
$arguments = $this->getArguments();
@ -144,8 +139,6 @@ class QueryTag {
$buff .= '$query->setColumns(' . $this->columns->toString() . ');'.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;
@ -156,18 +149,12 @@ class QueryTag {
}
function getTables(){
if($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);
if($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);
}
function getSubquery(){
if($this->query->query){
$this->subquery = new QueryTag($this->query->query, true);
}
}
function getConditions(){
return $this->conditions = new ConditionsTag($this->query->conditions);
}
@ -196,13 +183,12 @@ class QueryTag {
return $this->buff;
}
function getArguments(){
$arguments = array();
if($this->columns)
$arguments = array_merge($arguments, $this->columns->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->tables->getArguments());
$arguments = array_merge($arguments, $this->conditions->getArguments());
$arguments = array_merge($arguments, $this->navigation->getArguments());
return $arguments;