Added support for "REPLACE" SQL syntax.
This commit is contained in:
parent
c6bda10e3f
commit
3ea9ec8f36
2 changed files with 32 additions and 2 deletions
|
@ -66,6 +66,14 @@ class Model extends Object
|
|||
*/
|
||||
protected $delayed = false;
|
||||
|
||||
/**
|
||||
* Replace instead of Insert/Update?
|
||||
*
|
||||
* @access protected
|
||||
* @var boolean
|
||||
*/
|
||||
protected $replace = false;
|
||||
|
||||
/**
|
||||
* Field List
|
||||
*
|
||||
|
@ -866,7 +874,14 @@ class Model extends Object
|
|||
$update = (isset($this->record[$this->id]) && trim($this->record[$this->id]) != '');
|
||||
|
||||
// Establishes the query, optionally uses DELAYED INSERTS
|
||||
$sql = ($update === true ? 'UPDATE' : 'INSERT' . ($this->delayed == true ? ' DELAYED' : '') . ' INTO') . ' ' . $this->table . ' SET ';
|
||||
if ($this->replace === true)
|
||||
{
|
||||
$sql = 'REPLACE' . ($this->delayed == true ? ' DELAYED' : '') . ' INTO ' . $this->table . ' SET ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = ($update === true ? 'UPDATE' : 'INSERT' . ($this->delayed == true ? ' DELAYED' : '') . ' INTO') . ' ' . $this->table . ' SET ';
|
||||
}
|
||||
$input_parameters = null;
|
||||
|
||||
// Limits the columns being updated
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue