mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Add the experimental sqlite3_value_nochange() interface usable by xUpdate
methods of virtual tables to see if a column has actually changed values. FossilOrigin-Name: 8b7be15ece9e2e83959bb0e21e240106fe1077431242c3cc6b81f1baa2382f40
This commit is contained in:
23
src/vdbe.c
23
src/vdbe.c
@@ -464,7 +464,7 @@ static void memTracePrint(Mem *p){
|
||||
if( p->flags & MEM_Undefined ){
|
||||
printf(" undefined");
|
||||
}else if( p->flags & MEM_Null ){
|
||||
printf(" NULL");
|
||||
printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL");
|
||||
}else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
|
||||
printf(" si:%lld", p->u.i);
|
||||
}else if( p->flags & MEM_Int ){
|
||||
@@ -2794,7 +2794,11 @@ case OP_MakeRecord: {
|
||||
assert( memIsValid(pRec) );
|
||||
pRec->uTemp = serial_type = sqlite3VdbeSerialType(pRec, file_format, &len);
|
||||
if( pRec->flags & MEM_Zero ){
|
||||
if( nData ){
|
||||
if( serial_type==0 ){
|
||||
assert( pOp->p5==2 || CORRUPT_DB );
|
||||
/* serial_type 10 used internally only */
|
||||
pRec->uTemp = 10;
|
||||
}else if( nData ){
|
||||
if( sqlite3VdbeMemExpandBlob(pRec) ) goto no_mem;
|
||||
}else{
|
||||
nZero += pRec->u.nZero;
|
||||
@@ -6697,15 +6701,15 @@ case OP_VFilter: { /* jump */
|
||||
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
/* Opcode: VColumn P1 P2 P3 P4 *
|
||||
/* Opcode: VColumn P1 P2 P3 * P5
|
||||
** Synopsis: r[P3]=vcolumn(P2)
|
||||
**
|
||||
** Store in register P3 the value of the P2-th column of
|
||||
** the current row of the virtual-table of cursor P1.
|
||||
**
|
||||
** If the VColumn opcode is being used to fetch the value of
|
||||
** an unchanging column during an UPDATE operation, then the P4
|
||||
** value is 1. Otherwise, P4 is 0. The P4 value is returned
|
||||
** an unchanging column during an UPDATE operation, then the P5
|
||||
** value is 1. Otherwise, P5 is 0. The P5 value is returned
|
||||
** by sqlite3_vtab_nochange() routine can can be used
|
||||
** by virtual table implementations to return special "no-change"
|
||||
** marks which can be more efficient, depending on the virtual table.
|
||||
@@ -6730,8 +6734,13 @@ case OP_VColumn: {
|
||||
assert( pModule->xColumn );
|
||||
memset(&sContext, 0, sizeof(sContext));
|
||||
sContext.pOut = pDest;
|
||||
sContext.bVtabNoChng = pOp->p4.i!=0;
|
||||
MemSetTypeFlag(pDest, MEM_Null);
|
||||
if( pOp->p5 ){
|
||||
sqlite3VdbeMemSetNull(pDest);
|
||||
pDest->flags = MEM_Null|MEM_Zero;
|
||||
pDest->u.nZero = 0;
|
||||
}else{
|
||||
MemSetTypeFlag(pDest, MEM_Null);
|
||||
}
|
||||
rc = pModule->xColumn(pCur->uc.pVCur, &sContext, pOp->p2);
|
||||
sqlite3VtabImportErrmsg(p, pVtab);
|
||||
if( sContext.isError ){
|
||||
|
Reference in New Issue
Block a user