diff --git a/classes/db/queryparts/Query.class.php b/classes/db/queryparts/Query.class.php index 93f36f739..0e21f8e81 100644 --- a/classes/db/queryparts/Query.class.php +++ b/classes/db/queryparts/Query.class.php @@ -178,7 +178,8 @@ foreach($this->tables as $table){ if($table->isJoinTable() || !$simple_table_count) $from .= $table->toString($with_values) . ' '; else $from .= ', '.$table->toString($with_values) . ' '; - if(!$table->isJoinTable()) $from .= $table->getAlias() ? ' as ' . $table->getAlias() . ' ' : ' '; + + if(is_a($table, 'Subquery')) $from .= $table->getAlias() ? ' as ' . $table->getAlias() . ' ' : ' '; $simple_table_count++; } diff --git a/classes/db/queryparts/table/Table.class.php b/classes/db/queryparts/table/Table.class.php index 791a936d2..3a19d3a97 100644 --- a/classes/db/queryparts/table/Table.class.php +++ b/classes/db/queryparts/table/Table.class.php @@ -10,8 +10,8 @@ } function toString(){ - return $this->name; - //return sprintf("%s%s", $this->name, $this->alias ? ' as ' . $this->alias : ''); + //return $this->name; + return sprintf("%s%s", $this->name, $this->alias ? ' as ' . $this->alias : ''); } function getName(){ @@ -23,8 +23,7 @@ } function isJoinTable(){ - if(in_array($tableName,array('left join','left outer join','right join','right outer join'))) return true; - return false; + return false; } } diff --git a/classes/xml/xmlquery/argument/Argument.class.php b/classes/xml/xmlquery/argument/Argument.class.php index 2ebaa68ae..a3ed14a56 100644 --- a/classes/xml/xmlquery/argument/Argument.class.php +++ b/classes/xml/xmlquery/argument/Argument.class.php @@ -32,7 +32,7 @@ $value = $this->escapeValue($this->value); return $this->toString($value); } - + function getUnescapedValue(){ return $this->toString($this->value); }