Skip to content

Commit bfd0de8

Browse files
adaamzdg
authored andcommitted
SqlBuilder: UPDATE supports ORDER BY (#179)
1 parent 4ac6391 commit bfd0de8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/Database/Table/SqlBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ public function buildInsertQuery(): string
120120
public function buildUpdateQuery(): string
121121
{
122122
$query = "UPDATE {$this->delimitedTable} SET ?set" . $this->tryDelimite($this->buildConditions());
123+
124+
if ($this->order !== []) {
125+
$query .= ' ORDER BY ' . implode(', ', $this->order);
126+
}
127+
123128
if ($this->limit !== null || $this->offset) {
124129
$this->driver->applyLimit($query, $this->limit, $this->offset);
125130
}

0 commit comments

Comments
 (0)