MINOR: update sqlite3 to handle arrays of orderby queries

This commit is contained in:
Will Rossiter 2012-04-15 21:09:19 +12:00
parent bac4aac13f
commit 1233756a5d
1 changed files with 14 additions and 6 deletions

View File

@ -1046,6 +1046,7 @@ class SQLite3Database extends SS_Database {
public function sqlQueryToString(SQLQuery $sqlQuery) {
if (!$sqlQuery->from) return '';
$distinct = $sqlQuery->distinct ? "DISTINCT " : "";
if($sqlQuery->delete) {
$text = "DELETE ";
} else if($sqlQuery->select) {
@ -1053,10 +1054,17 @@ class SQLite3Database extends SS_Database {
}
if($sqlQuery->from) $text .= " FROM " . implode(" ", $sqlQuery->from);
if($sqlQuery->where) $text .= " WHERE (" . $sqlQuery->getFilter(). ")";
if($sqlQuery->groupby) $text .= " GROUP BY " . implode(", ", $sqlQuery->groupby);
if($sqlQuery->having) $text .= " HAVING ( " . implode(" ) AND ( ", $sqlQuery->having) . " )";
if($sqlQuery->orderby) $text .= " ORDER BY " . $this->orderMoreSpecifically($sqlQuery->select,$sqlQuery->orderby);
if($sqlQuery->where)
$text .= " WHERE (" . $sqlQuery->prepareSelect(). ")";
if($sqlQuery->groupby)
$text .= " GROUP BY " .$sqlQuery->prepareGroupBy();
if($sqlQuery->having)
$text .= " HAVING ( " . $sqlQuery->prepareHaving() . " )";
if($sqlQuery->orderby)
$text .= " ORDER BY " . $this->orderMoreSpecifically($sqlQuery->select, $sqlQuery->prepareOrderBy());
if($sqlQuery->limit) {
$limit = $sqlQuery->limit;