Subquery fix.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9858 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-11-22 17:11:53 +00:00
parent 99e196cd48
commit 7ee45e57c7

View file

@ -28,7 +28,10 @@ class QueryTag {
$this->query = $query;
$this->isSubQuery = $isSubQuery;
if($this->isSubQuery) $this->action = 'select';
$this->alias = $query->attrs->alias;
if($query->attrs->alias){
$dbParser = DB::getParser();
$this->alias = $dbParser->escape($query->attrs->alias);
}
$this->join_type = $query->attrs->join_type;
$this->getColumns();
@ -48,7 +51,7 @@ class QueryTag {
function getQueryId(){
return $this->query->attrs->query_id ? $this->query->attrs->query_id : $this->query->attrs->id;
}
function getPriority(){
return $this->query->attrs->priority;
}
@ -112,7 +115,7 @@ class QueryTag {
$buff = '';
if($this->isSubQuery){
$buff = 'new Subquery(';
$buff .= "'\"" . $this->alias . '"\', ';
$buff .= "'" . $this->alias . '\', ';
$buff .= ($this->columns ? $this->columns->toString() : 'null' ). ', '.PHP_EOL;
$buff .= $this->tables->toString() .','.PHP_EOL;
$buff .= $this->conditions->toString() .',' .PHP_EOL;