1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Merge latest changes from trunk. Including the "ORDER BY ... LIMIT" optimization.

FossilOrigin-Name: 83a4c9f0885768ed3cbe556aed9f4709a1d7a1cd52f2e3632ade28091febee47
This commit is contained in:
dan
2018-04-26 18:01:48 +00:00
21 changed files with 232 additions and 243 deletions

View File

@@ -613,6 +613,12 @@ void sqlite3Update(
j = aXRef[i];
if( j>=0 ){
sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i);
if( tmask&TRIGGER_BEFORE ){
/* Must preserve copied values even in case the original is
** reloaded in the After-BEFORE-trigger-reload-loop below.
** Ticket d85fffd6ffe856092ed8daefa811b1e399706b28 */
sqlite3VdbeSwapOpcode(v, -1, OP_SCopy, OP_Copy);
}
}else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){
/* This branch loads the value of a column that will not be changed
** into a register. This is done if there are no BEFORE triggers, or
@@ -650,10 +656,14 @@ void sqlite3Update(
VdbeCoverage(v);
}
/* If it did not delete it, the row-trigger may still have modified
/* After-BEFORE-trigger-reload-loop:
** If it did not delete it, the BEFORE trigger may still have modified
** some of the columns of the row being updated. Load the values for
** all columns not modified by the update statement into their
** registers in case this has happened.
** all columns not modified by the update statement into their registers
** in case this has happened. Only unmodified columns are reloaded.
** The values computed for modified columns use the values before the
** BEFORE trigger runs. See test case trigger1-18.0 (added 2018-04-26)
** for an example.
*/
for(i=0; i<pTab->nCol; i++){
if( aXRef[i]<0 && i!=pTab->iPKey ){