mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Consolidate more of the DISTINCT processing logic into a single spot in the
code. Reduce the number of OP_Column operations needed to perform a WHERE_DISTINCT_ORDERED. FossilOrigin-Name: 79e922f7ae29bbe06d639d648fbd72523cf9a28e
This commit is contained in:
28
src/vdbe.c
28
src/vdbe.c
@@ -1020,10 +1020,10 @@ case OP_Variable: { /* out2-prerelease */
|
||||
|
||||
/* Opcode: Move P1 P2 P3 * *
|
||||
**
|
||||
** Move the values in register P1..P1+P3-1 over into
|
||||
** registers P2..P2+P3-1. Registers P1..P1+P1-1 are
|
||||
** Move the values in register P1..P1+P3 over into
|
||||
** registers P2..P2+P3. Registers P1..P1+P3 are
|
||||
** left holding a NULL. It is an error for register ranges
|
||||
** P1..P1+P3-1 and P2..P2+P3-1 to overlap.
|
||||
** P1..P1+P3 and P2..P2+P3 to overlap.
|
||||
*/
|
||||
case OP_Move: {
|
||||
char *zMalloc; /* Holding variable for allocated memory */
|
||||
@@ -1031,7 +1031,7 @@ case OP_Move: {
|
||||
int p1; /* Register to copy from */
|
||||
int p2; /* Register to copy to */
|
||||
|
||||
n = pOp->p3;
|
||||
n = pOp->p3 + 1;
|
||||
p1 = pOp->p1;
|
||||
p2 = pOp->p2;
|
||||
assert( n>0 && p1>0 && p2>0 );
|
||||
@@ -1060,20 +1060,28 @@ case OP_Move: {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: Copy P1 P2 * * *
|
||||
/* Opcode: Copy P1 P2 P3 * *
|
||||
**
|
||||
** Make a copy of register P1 into register P2.
|
||||
** Make a copy of registers P1..P1+P3 into registers P2..P2+P3.
|
||||
**
|
||||
** This instruction makes a deep copy of the value. A duplicate
|
||||
** is made of any string or blob constant. See also OP_SCopy.
|
||||
*/
|
||||
case OP_Copy: { /* in1, out2 */
|
||||
case OP_Copy: {
|
||||
int n;
|
||||
|
||||
n = pOp->p3;
|
||||
pIn1 = &aMem[pOp->p1];
|
||||
pOut = &aMem[pOp->p2];
|
||||
assert( pOut!=pIn1 );
|
||||
sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
|
||||
Deephemeralize(pOut);
|
||||
REGISTER_TRACE(pOp->p2, pOut);
|
||||
while( 1 ){
|
||||
sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
|
||||
Deephemeralize(pOut);
|
||||
REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
|
||||
if( (n--)==0 ) break;
|
||||
pOut++;
|
||||
pIn1++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user