public function upsert($set = null, ?bool
$escape = null
) { // if set() has been used merge QBSet with binds and then setData()
if ($set === null && !
is_array(current($this->QBSet
))) { $set =
[];
foreach ($this->QBSet
as $field =>
$value) { $k =
trim($field,
$this->db->escapeChar
);
// use binds if available else use QBSet value but with RawSql to avoid escape
$set[$k] =
isset($this->binds
[$k]) ?
$this->binds
[$k][0
] :
new RawSql($value);
} $this->binds =
[];
$this->
resetRun([ 'QBSet' =>
[],
'QBKeys' =>
[],
]);
$this->
setData($set, true
); // unescaped items are RawSql now
} elseif ($set !== null
) {