aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2008-07-04 10:56:07 +0000
committerdanielk1977 <danielk1977@noemail.net>2008-07-04 10:56:07 +0000
commitbb50e7ad764d526fe73fc64b9deca15e870e5ba0 (patch)
treedab250f0edc6a45cfab3d381e853931bd702a0a9 /src
parent2f425f6b64757e4d7e2befdc8ba96fa7470b31e9 (diff)
downloadsqlite-bb50e7ad764d526fe73fc64b9deca15e870e5ba0.tar.gz
sqlite-bb50e7ad764d526fe73fc64b9deca15e870e5ba0.zip
Fix for explicitly inserting a NULL value into the rowid column of a virtual table. (CVS 5343)
FossilOrigin-Name: a7f3b431669f7392a6acba8cd8f3fa5297a916b5
Diffstat (limited to 'src')
-rw-r--r--src/insert.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/insert.c b/src/insert.c
index 267110a16..afb391473 100644
--- a/src/insert.c
+++ b/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.243 2008/06/24 12:46:31 drh Exp $
+** $Id: insert.c,v 1.244 2008/07/04 10:56:08 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -836,7 +836,7 @@ void sqlite3Insert(
VdbeOp *pOp;
sqlite3ExprCode(pParse, pList->a[keyColumn].pExpr, regRowid);
pOp = sqlite3VdbeGetOp(v, sqlite3VdbeCurrentAddr(v) - 1);
- if( pOp && pOp->opcode==OP_Null ){
+ if( pOp && pOp->opcode==OP_Null && !IsVirtual(pTab) ){
appendFlag = 1;
pOp->opcode = OP_NewRowid;
pOp->p1 = baseCur;
@@ -849,9 +849,14 @@ void sqlite3Insert(
*/
if( !appendFlag ){
int j1;
- j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid);
- sqlite3VdbeAddOp3(v, OP_NewRowid, baseCur, regRowid, regAutoinc);
- sqlite3VdbeJumpHere(v, j1);
+ if( !IsVirtual(pTab) ){
+ j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid);
+ sqlite3VdbeAddOp3(v, OP_NewRowid, baseCur, regRowid, regAutoinc);
+ sqlite3VdbeJumpHere(v, j1);
+ }else{
+ j1 = sqlite3VdbeCurrentAddr(v);
+ sqlite3VdbeAddOp2(v, OP_IsNull, regRowid, j1+2);
+ }
sqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid);
}
}else if( IsVirtual(pTab) ){