1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +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:
drh
2015-03-06 16:45:16 +00:00
parent 8dd7a6a925
commit f07cf6e2a5
5 changed files with 73 additions and 18 deletions

View File

@@ -69,6 +69,8 @@ struct WhereLevel {
int addrCont; /* Jump here to continue with the next loop cycle */
int addrFirst; /* First instruction of interior of the loop */
int addrBody; /* Beginning of the body of this loop */
int iLikeRepCntr; /* LIKE range processing counter register */
int addrLikeRep; /* LIKE range processing address */
u8 iFrom; /* Which entry in the FROM clause */
u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */
int p1, p2; /* Operands of the opcode used to ends the loop */
@@ -253,7 +255,7 @@ struct WhereTerm {
} u;
LogEst truthProb; /* Probability of truth for this expression */
u16 eOperator; /* A WO_xx value describing <op> */
u8 wtFlags; /* TERM_xxx bit flags. See below */
u16 wtFlags; /* TERM_xxx bit flags. See below */
u8 nChild; /* Number of children that must disable us */
WhereClause *pWC; /* The clause this term is part of */
Bitmask prereqRight; /* Bitmask of tables used by pExpr->pRight */
@@ -275,6 +277,7 @@ struct WhereTerm {
#else
# define TERM_VNULL 0x00 /* Disabled if not using stat3 */
#endif
#define TERM_LIKEOPT 0x100 /* Used by the LIKE optimization */
/*
** An instance of the WhereScan object is used as an iterator for locating