diff options
author | dan <dan@noemail.net> | 2017-01-10 20:04:38 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2017-01-10 20:04:38 +0000 |
commit | f91c1318f48febae7d3aac6c14b70068f1a2c375 (patch) | |
tree | 04dcd2c1d26dc01d784eb92f2aa5967791ac2457 /src/insert.c | |
parent | f112f0b3deb251173c6695769bf2f622bbaadfb6 (diff) | |
download | sqlite-f91c1318f48febae7d3aac6c14b70068f1a2c375.tar.gz sqlite-f91c1318f48febae7d3aac6c14b70068f1a2c375.zip |
Changes to allow some multi-row UPDATE statements to avoid the two-pass
approach.
FossilOrigin-Name: 46db23ccd116ce5b9d949f9293be8a2818411b46
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c index a33ee1235..93c22ae3f 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1684,7 +1684,7 @@ void sqlite3CompleteInsertion( int iIdxCur, /* First index cursor */ int regNewData, /* Range of content */ int *aRegIdx, /* Register used by each index. 0 for unused indices */ - int isUpdate, /* True for UPDATE, False for INSERT */ + int update_flags, /* True for UPDATE, False for INSERT */ int appendBias, /* True if this is likely to be an append */ int useSeekResult /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */ ){ @@ -1696,6 +1696,11 @@ void sqlite3CompleteInsertion( int i; /* Loop counter */ u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */ + assert( update_flags==0 + || update_flags==OPFLAG_ISUPDATE + || update_flags==(OPFLAG_ISUPDATE|OPFLAG_SAVEPOSITION) + ); + v = sqlite3GetVdbe(pParse); assert( v!=0 ); assert( pTab->pSelect==0 ); /* This table is not a VIEW */ @@ -1714,6 +1719,7 @@ void sqlite3CompleteInsertion( if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ assert( pParse->nested==0 ); pik_flags |= OPFLAG_NCHANGE; + pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); } sqlite3VdbeChangeP5(v, pik_flags); } @@ -1729,7 +1735,7 @@ void sqlite3CompleteInsertion( pik_flags = 0; }else{ pik_flags = OPFLAG_NCHANGE; - pik_flags |= (isUpdate?OPFLAG_ISUPDATE:OPFLAG_LASTROWID); + pik_flags |= (update_flags?update_flags:OPFLAG_LASTROWID); } if( appendBias ){ pik_flags |= OPFLAG_APPEND; |