1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Fix a bug in the KEYINFO handling within select.c. Change the OP_Move

opcode to take a count and to move multiple registers.  Initial code for
the compound-select merge optimization is added but is incomplete
and is commented out. (CVS 5272)

FossilOrigin-Name: 663a590e3086145a57af7569d8f798b6b6a8b76c
This commit is contained in:
drh
2008-06-22 12:37:57 +00:00
parent 04bcc00788
commit b21e7c70f7
10 changed files with 424 additions and 73 deletions

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.373 2008/06/05 16:47:39 danielk1977 Exp $
** $Id: expr.c,v 1.374 2008/06/22 12:37:58 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -2112,16 +2112,17 @@ void sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){
}
/*
** Generate code to moves content from one register to another.
** Keep the column cache up-to-date.
** Generate code to move content from registers iFrom...iFrom+nReg-1
** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.
*/
void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo){
void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){
int i;
if( iFrom==iTo ) return;
sqlite3VdbeAddOp2(pParse->pVdbe, OP_Move, iFrom, iTo);
sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);
for(i=0; i<pParse->nColCache; i++){
if( pParse->aColCache[i].iReg==iFrom ){
pParse->aColCache[i].iReg = iTo;
int x = pParse->aColCache[i].iReg;
if( x>=iFrom && x<iFrom+nReg ){
pParse->aColCache[i].iReg += iTo-iFrom;
}
}
}