Removed code for creating final SELECT statement - this will be moved to db classes.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8425 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-06-01 10:19:58 +00:00
parent 68f068cf88
commit b4ca6896bc

View file

@ -68,55 +68,6 @@
function getSql(){
if($this->action == 'select') return $this->getSelectSql();
}
function getSelectSql(){
$query = '';
$select = 'SELECT ';
foreach($this->columns as $column){
if($column->show())
$select .= $column->getExpression() . ', ';
}
$select = substr($select, 0, -2);
$from = 'FROM ';
$simple_table_count = 0;
foreach($this->tables as $table){
if($table->isJoinTable() || !$simple_table_count) $from .= $table->toString() . ' ';
else $from .= ', '.$table->toString() . ' ';
$simple_table_count++;
}
$where = '';
if(count($this->conditions) > 0){
$where = 'WHERE ';
foreach($this->conditions as $conditionGroup){
$where .= $conditionGroup->toString();
}
}
$groupBy = '';
if($this->groups) if($this->groups[0] !== "")
$groupBy = 'GROUP BY ' . implode(', ', $this->groups);
$orderBy = '';
if(count($this->orderby) > 0){
$orderBy = 'ORDER BY ';
foreach($this->orderby as $order){
$orderBy .= $order->toString() .', ';
}
$orderBy = substr($orderBy, 0, -2);
}
$limit = '';
if(count($this->limit) > 0){
$limit = 'limit ';
$limit .= $this->limit->toString();
}
$query = $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
return $query;
}
}