Skip to content

Commit

Permalink
Optimise the update
Browse files Browse the repository at this point in the history
  • Loading branch information
danrwalker committed Jul 25, 2017
1 parent 75cf605 commit f6b3df1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions dist/twist/Core/Models/Database/Record.model.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,14 @@ public function commit($blInsert = false){

if(substr($strSQL,0,6) === 'INSERT'){

$mxdOut = true;
$strAutoIncrementField = $this->detectAutoIncrement();

if(is_null($strAutoIncrementField)){
$mxdOut = true;
}else{
if(!is_null($strAutoIncrementField)){
$mxdOut = $resResult->insertID();

//Find an auto increment field and update the ID in the record
$this->arrOriginalRecord[$strAutoIncrementField] = $mxdOut;
$this->arrRecord[$strAutoIncrementField] = $mxdOut;
//Update the auto increment field in the record
$this->arrOriginalRecord[$strAutoIncrementField] = $this->arrRecord[$strAutoIncrementField] = $mxdOut;
}

}else if($resResult->affectedRows() !== 0){
Expand Down

0 comments on commit f6b3df1

Please sign in to comment.