mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
MINOR: update sqlite3 to handle arrays of orderby queries
This commit is contained in:
parent
bac4aac13f
commit
1233756a5d
@ -91,7 +91,7 @@ class SQLite3Database extends SS_Database {
|
|||||||
$this->dbConn = new SQLite3($file, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, $parameters['key']);
|
$this->dbConn = new SQLite3($file, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, $parameters['key']);
|
||||||
if(method_exists('SQLite3', 'busyTimeout')) $this->dbConn->busyTimeout(60000);
|
if(method_exists('SQLite3', 'busyTimeout')) $this->dbConn->busyTimeout(60000);
|
||||||
|
|
||||||
//By virtue of getting here, the connection is active:
|
// By virtue of getting here, the connection is active:
|
||||||
$this->active=true;
|
$this->active=true;
|
||||||
$this->database = $dbName;
|
$this->database = $dbName;
|
||||||
|
|
||||||
@ -1046,6 +1046,7 @@ class SQLite3Database extends SS_Database {
|
|||||||
public function sqlQueryToString(SQLQuery $sqlQuery) {
|
public function sqlQueryToString(SQLQuery $sqlQuery) {
|
||||||
if (!$sqlQuery->from) return '';
|
if (!$sqlQuery->from) return '';
|
||||||
$distinct = $sqlQuery->distinct ? "DISTINCT " : "";
|
$distinct = $sqlQuery->distinct ? "DISTINCT " : "";
|
||||||
|
|
||||||
if($sqlQuery->delete) {
|
if($sqlQuery->delete) {
|
||||||
$text = "DELETE ";
|
$text = "DELETE ";
|
||||||
} else if($sqlQuery->select) {
|
} else if($sqlQuery->select) {
|
||||||
@ -1053,10 +1054,17 @@ class SQLite3Database extends SS_Database {
|
|||||||
}
|
}
|
||||||
if($sqlQuery->from) $text .= " FROM " . implode(" ", $sqlQuery->from);
|
if($sqlQuery->from) $text .= " FROM " . implode(" ", $sqlQuery->from);
|
||||||
|
|
||||||
if($sqlQuery->where) $text .= " WHERE (" . $sqlQuery->getFilter(). ")";
|
if($sqlQuery->where)
|
||||||
if($sqlQuery->groupby) $text .= " GROUP BY " . implode(", ", $sqlQuery->groupby);
|
$text .= " WHERE (" . $sqlQuery->prepareSelect(). ")";
|
||||||
if($sqlQuery->having) $text .= " HAVING ( " . implode(" ) AND ( ", $sqlQuery->having) . " )";
|
|
||||||
if($sqlQuery->orderby) $text .= " ORDER BY " . $this->orderMoreSpecifically($sqlQuery->select,$sqlQuery->orderby);
|
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) {
|
if($sqlQuery->limit) {
|
||||||
$limit = $sqlQuery->limit;
|
$limit = $sqlQuery->limit;
|
||||||
|
Loading…
Reference in New Issue
Block a user