mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
The LIKE optimization must be applied twice, once for strings and a second
time for BLOBs. Ticket [05f43be8fdda9f]. This check-in is a proof-of-concept of how that might be done. FossilOrigin-Name: 5757e803cb5759b476bbc6453c58340089611420
This commit is contained in:
16
src/vdbe.c
16
src/vdbe.c
@@ -1015,7 +1015,7 @@ case OP_Real: { /* same as TK_FLOAT, out2-prerelease */
|
||||
** Synopsis: r[P2]='P4'
|
||||
**
|
||||
** P4 points to a nul terminated UTF-8 string. This opcode is transformed
|
||||
** into a String before it is executed for the first time. During
|
||||
** into a String opcode before it is executed for the first time. During
|
||||
** this transformation, the length of string P4 is computed and stored
|
||||
** as the P1 parameter.
|
||||
*/
|
||||
@@ -1047,10 +1047,15 @@ case OP_String8: { /* same as TK_STRING, out2-prerelease */
|
||||
/* Fall through to the next case, OP_String */
|
||||
}
|
||||
|
||||
/* Opcode: String P1 P2 * P4 *
|
||||
/* Opcode: String P1 P2 P3 P4 P5
|
||||
** Synopsis: r[P2]='P4' (len=P1)
|
||||
**
|
||||
** The string value P4 of length P1 (bytes) is stored in register P2.
|
||||
**
|
||||
** If P5!=0 and the content of register P3 is greater than zero, then
|
||||
** the datatype of the register P2 is convert to BLOB. The content is
|
||||
** the same string text, it is merely interpreted as a BLOB as if it
|
||||
** had been CAST.
|
||||
*/
|
||||
case OP_String: { /* out2-prerelease */
|
||||
assert( pOp->p4.z!=0 );
|
||||
@@ -1059,6 +1064,13 @@ case OP_String: { /* out2-prerelease */
|
||||
pOut->n = pOp->p1;
|
||||
pOut->enc = encoding;
|
||||
UPDATE_MAX_BLOBSIZE(pOut);
|
||||
if( pOp->p5 ){
|
||||
assert( pOp->p3>0 );
|
||||
assert( pOp->p3<=(p->nMem-p->nCursor) );
|
||||
pIn3 = &aMem[pOp->p3];
|
||||
assert( pIn3->flags & MEM_Int );
|
||||
if( pIn3->u.i ) pOut->flags = MEM_Blob|MEM_Static|MEM_Term;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user