$builder =
$this->
builder();
if ($id) { $builder =
$builder->
whereIn($this->table . '.' .
$this->primaryKey,
$id);
} // Must use the set() method to ensure to set the correct escape flag
foreach ($data as $key =>
$val) { $builder->
set($key,
$val,
$escape[$key] ?? null
);
} if ($builder->
getCompiledQBWhere() ===
[]) { throw new DatabaseException( 'Updates are not allowed unless they contain a "where" or "like" clause.'
);
} return $builder->
update();
} /**
* Compiles an update string and runs the query
* This method works only with dbCalls.
*
* @param array|null $set An associative array of update values
* @param string|null $index The where key
* @param int $batchSize The size of the batch to run
* @param bool $returnSQL True means SQL is returned, false will execute the query
*
* @return false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode
*
* @throws DatabaseException
*/