- Added the replace keyword

This commit is contained in:
Dave Mc Nicoll committed 2021-08-02 15:13:17 +00:00
1 parent 7fb591e1f5
commit 0453e9cbc5
4 files changed
+45 -17

No files matched your search

+9 -5
View File
@@ -4,12 +4,16 @@ namespace Ulmus\Query;
class Insert extends Fragment {
const SQL_TOKEN = "INSERT";
const SQL_INSERT_TOKEN = "INSERT";
const SQL_REPLACE_TOKEN = "REPLACE";
public int $order = -100;
public bool $quick = false;
public bool $replace = false;
public bool $ignore = false;
public array $fieldlist = [];
@@ -19,11 +23,11 @@ class Insert extends Fragment {
public string $table;
public ? string $alias = null;
public function render() : string
{
return $this->renderSegments([
static::SQL_TOKEN,
$this->replace ? static::SQL_REPLACE_TOKEN : static::SQL_INSERT_TOKEN,
( $this->priority ?? false ),
( $this->ignore ? 'IGNORE' : false ),
'INTO', $this->table,
+1 -1
View File
@@ -114,7 +114,7 @@ class Where extends Fragment {
}
# whitelisting operators
return in_array(strtoupper($this->operator), [ '=', '!=', '<>', 'LIKE', 'IS', 'IS NOT' ]) ? $this->operator : "=";
return in_array(strtoupper($this->operator), [ '=', '!=', '>', '>=', '<', '<=', '<>', 'LIKE', 'IS', 'IS NOT' ]) ? $this->operator : "=";
}
protected function value()