mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Fix a bug in XFER optimization introduced by check-in (3736). (CVS 3744)
FossilOrigin-Name: 3714ac173289e580a0302a5a3beac05823d92c5b
This commit is contained in:
14
src/insert.c
14
src/insert.c
@@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle INSERT statements in SQLite.
|
||||
**
|
||||
** $Id: insert.c,v 1.180 2007/03/29 05:51:49 drh Exp $
|
||||
** $Id: insert.c,v 1.181 2007/03/29 13:35:36 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -1517,11 +1517,13 @@ static int xferOptimization(
|
||||
}
|
||||
sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
|
||||
emptySrcTest = sqlite3VdbeAddOp(v, OP_Rewind, iSrc, 0);
|
||||
if( pDest->iPKey>=0 ){
|
||||
memRowid = pParse->nMem++;
|
||||
if( pDest->pIndex!=0 ){
|
||||
sqlite3VdbeAddOp(v, OP_Rowid, iSrc, 0);
|
||||
sqlite3VdbeAddOp(v, OP_MemStore, memRowid, 1);
|
||||
addr1 = sqlite3VdbeAddOp(v, OP_Rowid, iSrc, 0);
|
||||
memRowid = pParse->nMem++;
|
||||
sqlite3VdbeAddOp(v, OP_MemStore, memRowid, pDest->iPKey>=0);
|
||||
}
|
||||
addr1 = sqlite3VdbeAddOp(v, OP_Rowid, iSrc, 0);
|
||||
if( pDest->iPKey>=0 ){
|
||||
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
|
||||
addr2 = sqlite3VdbeAddOp(v, OP_NotExists, iDest, 0);
|
||||
sqlite3VdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, onError,
|
||||
@@ -1529,7 +1531,7 @@ static int xferOptimization(
|
||||
sqlite3VdbeJumpHere(v, addr2);
|
||||
autoIncStep(pParse, counterMem);
|
||||
}else{
|
||||
addr1 = sqlite3VdbeAddOp(v, OP_Rowid, iSrc, 0);
|
||||
assert( pDest->autoInc==0 );
|
||||
}
|
||||
sqlite3VdbeAddOp(v, OP_RowData, iSrc, 0);
|
||||
sqlite3VdbeOp3(v, OP_Insert, iDest,
|
||||
|
||||
Reference in New Issue
Block a user