aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-10-30 16:50:00 +0000
committerdrh <drh@noemail.net>2015-10-30 16:50:00 +0000
commitd286b9fb7d38fc3b48e89e50bc379e9cb2c1d260 (patch)
tree0a0c50d4383a6c85f3426a60ec1899c6b984893f /src/insert.c
parent5db990147917f9dc8b13f2d2f6240d28c8df9212 (diff)
parentb457764d01a88021b70e9e13ec1e7f70ea8cb175 (diff)
downloadsqlite-d286b9fb7d38fc3b48e89e50bc379e9cb2c1d260.tar.gz
sqlite-d286b9fb7d38fc3b48e89e50bc379e9cb2c1d260.zip
Merge all the latest enhancements from trunk.
FossilOrigin-Name: 395a153ff7b3c7a72f3d02b6fe76d72383f4e480
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c
index 95b291f83..f4af3391d 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -762,7 +762,7 @@ void sqlite3Insert(
/* If this is not a view, open the table and and all indices */
if( !isView ){
int nIdx;
- nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, -1, 0,
+ nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0,
&iDataCur, &iIdxCur);
aRegIdx = sqlite3DbMallocRaw(db, sizeof(int)*(nIdx+1));
if( aRegIdx==0 ){
@@ -1431,7 +1431,7 @@ void sqlite3GenerateConstraintChecks(
}else{
x = iField + regNewData + 1;
}
- sqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i);
+ sqlite3VdbeAddOp2(v, iField<0 ? OP_IntCopy : OP_SCopy, x, regIdx+i);
VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
}
}
@@ -1659,6 +1659,7 @@ int sqlite3OpenTableAndIndices(
Parse *pParse, /* Parsing context */
Table *pTab, /* Table to be opened */
int op, /* OP_OpenRead or OP_OpenWrite */
+ u8 p5, /* P5 value for OP_Open* instructions */
int iBase, /* Use this for the table cursor, if there is one */
u8 *aToOpen, /* If not NULL: boolean for each table and index */
int *piDataCur, /* Write the database source cursor number here */
@@ -1671,6 +1672,7 @@ int sqlite3OpenTableAndIndices(
Vdbe *v;
assert( op==OP_OpenRead || op==OP_OpenWrite );
+ assert( op==OP_OpenWrite || p5==0 );
if( IsVirtual(pTab) ){
/* This routine is a no-op for virtual tables. Leave the output
** variables *piDataCur and *piIdxCur uninitialized so that valgrind
@@ -1698,6 +1700,7 @@ int sqlite3OpenTableAndIndices(
if( aToOpen==0 || aToOpen[i+1] ){
sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
+ sqlite3VdbeChangeP5(v, p5);
VdbeComment((v, "%s", pIdx->zName));
}
}