Compare commits

..

No commits in common. "master" and "3.5.8" have entirely different histories.

View file

@ -35,7 +35,7 @@
*/
private function throw_if_no_table() {
if (!isset($this->table)) {
if (!$this->table) {
throw new Exception("No table name defined");
}
}
@ -163,8 +163,17 @@
return $this;
}
// Coerce offset to zero if no offset is defined
$offset = $offset ?? 0;
// Set LIMIT without range directly as integer
if (is_int($limit)) {
$this->limit = $limit;
return $this;
}
// No offset defined, set limit property directly as string
if (is_null($offset)) {
$this->limit = (string) $limit;
return $this;
}
// Set limit and offset as SQL CSV
$this->limit = "{$offset},{$limit}";
@ -268,14 +277,9 @@
$this->throw_if_no_table();
// Set DELETE WHERE conditions from arguments
if ($conditions) {
$this->where(...$conditions);
}
// Get array of SQL WHERE string and filter values
$filter_sql = !is_null($this->filter_sql) ? " WHERE {$this->filter_sql}" : "";
$sql = "DELETE FROM `{$this->table}`{$filter_sql}";
$sql = "DELETE FROM `{$this->table}` WHERE {$this->filter_sql}";
return $this->execute_query($sql, self::to_list_array($this->filter_values));
}