Lines Matching refs:WHERE

4490 ** WHERE clause might influence the choice of query plan for a statement,
4494 ** ^The specific value of a WHERE-clause [parameter] might influence the
4636 ** ^For example, an UPDATE statement might have a WHERE clause that
4982 ** WHERE clause constraints and the table content, it might return no rows.
5578 ** index expressions, or the WHERE clause of partial indexes.
5714 ** with the WHERE clause of [partial indexes] or in [generated columns].
7442 ** ^(The aConstraint[] array records WHERE clause constraints of the form:
7455 ** and makes other simplifications to the WHERE clause in an attempt to
7456 ** get as many WHERE clause terms into the form shown above as possible.
7457 ** ^The aConstraint[] array only reports WHERE clause terms that are
7541 } *aConstraint; /* Table of WHERE clause constraints */
7579 ** an operator that is part of a constraint term in the WHERE clause of
7803 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
9992 ** <li><p> If the constraint comes from a WHERE clause expression that contains
10889 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
10915 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
12341 ** UPDATE t1 SET b = 'v2' WHERE a=1;
12831 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
18095 Expr *pPartIdxWhere; /* WHERE clause for partial indices */
18681 #define WHERE_OR_SUBCLAUSE 0x0020 /* Processing a sub-WHERE as part of
18749 #define NC_PartIdx 0x000002 /* True if resolving a partial index WHERE */
18777 ** WHERE clause used to identify partial unique indexes.
18781 ** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
18782 ** WHERE clause is omitted.
18786 Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
18788 Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
18832 Expr *pWhere; /* The WHERE clause */
19359 ** pWhere -> The WHERE clause of the DELETE statement if one is specified.
19364 ** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
19385 Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
19574 Select *pSelect; /* HAVING to WHERE clause ctx */
19576 struct WhereConst *pConst; /* WHERE clause constants */
31642 sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
32323 sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
32369 sqlite3TreeViewLine(pView, "WHERE");
32511 sqlite3TreeViewLine(pView, "WHERE");
82892 ** means in the WHERE clause of a partial index. NC_GenCol means called
89366 ** parameter in the WHERE clause might influence the choice of query plan
97157 ** that match the WHERE clause P4. If P4 is a NULL pointer, then the
97202 "SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid",
104227 ** we are resolving names in the WHERE clause of the following command:
104229 ** SELECT a+b AS x FROM table WHERE x<10;
104234 ** resolved by the time the WHERE clause is resolved.
104236 ** The ability to use an output result-set column in the WHERE, GROUP BY,
104489 const char *zIn = "partial index WHERE clauses";
105480 ** expressions in the WHERE clause (etc.) can refer to expressions by
105766 ** (2) WHERE clauses on partial indices NC_PartIdx
105850 ** i.e. the WHERE clause expressions in the following statements all
105854 ** SELECT * FROM t1 WHERE a;
105855 ** SELECT a AS b FROM t1 WHERE b;
105856 ** SELECT * FROM t1 WHERE (select a from t1);
108136 ** operand of a RIGHT JOIN, then pExpr must be from the WHERE
108187 ** be promoted into the WHERE clause. In order for such a promotion to work,
108412 if( p->pWhere ) return 0; /* Has no WHERE clause */
109968 /* This COLUMN expression is really a constant due to WHERE clause
111766 ** an ordinary JOIN. The p argument is the WHERE clause. If the WHERE
112390 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
112401 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
112420 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
112427 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
112545 "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)"
112561 "WHERE tbl_name=%Q COLLATE nocase AND "
112574 "UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q",
112590 "WHERE type IN ('view', 'trigger')"
112747 "WHERE type = 'table' AND name = %Q",
112782 " WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*'",
112980 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' "
112990 "WHERE type IN ('trigger', 'view')",
114514 "WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)"
114709 ** that indexed columns are compared against in the WHERE clauses of
114835 "DELETE FROM %Q.%s WHERE %s=%Q",
115452 ** * "WHERE a=?" matches 10 rows, and
115453 ** * "WHERE a=? AND b=?" matches 2 rows.
120354 " WHERE rowid=#%d",
120739 " SET rootpage=%d WHERE #%d AND rootpage=#%d",
120813 "DELETE FROM %Q.%s WHERE %s=%Q",
120859 "DELETE FROM %Q.sqlite_sequence WHERE name=%Q",
120874 " WHERE tbl_name=%Q and type!='trigger'",
121381 Expr *pPIWhere, /* WHERE clause for partial indices */
122082 "DELETE FROM %Q." LEGACY_SCHEMA_TABLE " WHERE name=%Q AND type='index'",
123832 ** pWhere argument is an optional WHERE clause that restricts the
123838 Expr *pWhere, /* Optional WHERE clause to be added */
123867 ** Generate an expression tree to implement the WHERE, ORDER BY,
123870 ** DELETE FROM table_wxyz WHERE a<5 ORDER BY a LIMIT 1;
123877 Expr *pWhere, /* The WHERE clause. May be null */
123884 Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */
123908 ** DELETE FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
123910 ** DELETE FROM table_a WHERE rowid IN (
123911 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
123959 /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
123970 ** DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;
123977 Expr *pWhere, /* The WHERE clause. May be null */
123984 WhereInfo *pWInfo; /* Information about the WHERE clause */
124010 ** subqueries in the WHERE clause */
124124 /* Resolve the column names in the WHERE clause.
124146 /* Special case: A DELETE without a WHERE clause deletes everything.
124205 ** to be deleted, based on the WHERE clause. Set variable eOnePass
124631 ** A partial index should be skipped if its WHERE clause evaluates
127683 Expr *pWhere = 0; /* WHERE clause to scan with */
127684 NameContext sNameContext; /* Context used to resolve WHERE clause */
127725 ** to the WHERE clause that prevent this entry from being scanned.
127726 ** The added WHERE clause terms are like this:
127762 /* Resolve the references in the WHERE clause. */
127768 /* Create VDBE to loop through the entries in pSrc that match the WHERE
127779 /* Clean up the WHERE clause constructed above. */
128325 ** DELETE FROM c WHERE ck = old.pk;
128355 Expr *pWhere = 0; /* WHERE clause of trigger step */
129222 ** and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and
130787 /* Skip partial indices for which the WHERE clause is not true */
131319 ** * The index has the exact same WHERE clause
131350 return 0; /* Different WHERE clauses */
131429 return 0; /* SELECT may not have a WHERE clause */
138336 Expr *pWhere, /* the WHERE clause */
138599 ** of the more general WHERE clause. These terms are moved over to the
138600 ** WHERE clause during join processing but we need to remember that they
138603 ** The Expr.w.iJoin tells the WHERE clause processing that the
138640 ** "pushed down" into the WHERE clause of a subquery.
138683 ** WHERE clause to enforce the specified constraints. The extra
138684 ** WHERE clause terms will be tagged with EP_OuterON or
138744 /* Create extra terms on the WHERE clause for each column named
138747 ** to the WHERE clause: A.X=B.X AND A.Y=B.Y AND A.Z=B.Z
138824 /* Add the ON clause to the end of the WHERE clause, connected by
142311 ** SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5
142317 ** has no indices, the WHERE clause on the outer query cannot be
142323 ** SELECT x+y AS a FROM t1 WHERE z<100 AND a>5
142408 ** The parent and sub-query may contain WHERE clauses. Subject to
142426 ** have a WHERE clause.
142492 Expr *pWhere; /* The WHERE clause */
142688 ** ) WHERE a!=5 ORDER BY 1
142692 ** SELECT x+1 FROM tab WHERE x+1!=5
142694 ** SELECT y+1 FROM tab WHERE y+1!=5
142696 ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5
142827 ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;
142919 ** a known value due to WHERE clause constraints of the form COLUMN=VALUE.
143059 ** This is a Walker expression callback. pExpr is a node from the WHERE
143095 ** The WHERE-clause constant propagation optimization.
143097 ** If the WHERE clause contains terms of the form COLUMN=CONSTANT or
143104 ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=t1.a AND t3.c=t2.b
143108 ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=39 AND t3.c=39
143117 ** SELECT * FROM t1 WHERE a=123 AND b=a;
143118 ** SELECT * FROM t1 WHERE a=123 AND b=123;
143134 ** SELECT 1 FROM t1 WHERE x=10 AND x LIKE 10;
143137 ** and '10.0' is not LIKE '10'. But if we are not careful, the first WHERE
143138 ** term "x=10" will cause the second WHERE term to become "10 LIKE 10",
143191 ** push WHERE clause expression pExpr down to FROM clause sub-query
143218 ** Make copies of relevant WHERE clause terms of the outer query into
143219 ** the WHERE clause of subquery. Example:
143221 ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10;
143225 ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1 WHERE a=5 AND c-d=10)
143226 ** WHERE x=5 AND y=10;
143243 ** (3) The inner query has a LIMIT clause (since the changes to the WHERE
143250 ** (5) The WHERE clause expression originates in the ON or USING clause
143263 ** (6) Window functions make things tricky as changes to the WHERE clause
143272 ** (6c) The WHERE clause does not consist entirely of constants and
143289 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
143294 Select *pSubq, /* The subquery whose WHERE clause is to be augmented */
143295 Expr *pWhere, /* The WHERE clause of the outer query */
143964 ** (3) Add terms to the WHERE clause to accommodate the NATURAL keyword
144435 ** * ON and USING clauses are shifted into WHERE statements
144661 ** sub-expression matches the criteria for being moved to the WHERE
144662 ** clause. If so, add it to the WHERE clause and replace the sub-expression
144672 ** belongs to an outer query. Do not move the expression to the WHERE
144696 ** processed after grouping, to the WHERE clause, which is processed before
144699 ** SELECT * FROM <tables> WHERE a=? GROUP BY b HAVING b=? AND c=?
144703 ** SELECT * FROM <tables> WHERE a=? AND b=? GROUP BY b HAVING c=?
144718 SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
144784 ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
144785 ** * The outer query is a simple count(*) with no WHERE clause or other
144811 if( pSub->pWhere ) return 0; /* No WHERE clause */
144906 Expr *pWhere; /* The WHERE clause. May be NULL */
145037 ** of the LEFT JOIN used in the WHERE clause.
145164 /* Do the WHERE-clause constant propagation optimization if this is
145245 /* Make copies of constant WHERE-clause terms in the outer query down
145256 ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
146898 Expr *pWhere, /* The WHERE clause */
146936 Expr *pWhere, /* The WHERE clause */
147055 "DELETE FROM %Q." LEGACY_SCHEMA_TABLE " WHERE name=%Q AND type='trigger'",
147866 Expr *pWhere, /* WHERE clause of the UPDATE statement */
147993 ** SELECT <other-columns>, pChanges FROM pTabList WHERE pWhere
148002 ** WHERE pWhere
148033 Expr *pWhere, /* WHERE clause for query */
148118 ** UPDATE OR IGNORE tbl SET a=b, c=d FROM tbl2... WHERE e<5 AND f NOT NULL;
148128 Expr *pWhere, /* The WHERE clause. May be null */
148137 WhereInfo *pWInfo = 0; /* Information about the WHERE clause */
148398 /* The SET expressions are not actually used inside the WHERE loop.
148485 ** WHERE clause.
148585 ** UPDATE t1 SET b=b+1 WHERE b>?
148605 /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
148951 ** all record selected by the WHERE clause have been updated.
149031 Expr *pWhere, /* WHERE clause of the UPDATE statement */
149249 Expr *pTargetWhere, /* Optional WHERE clause on the target */
149251 Expr *pWhere, /* WHERE clause for the ON CONFLICT UPDATE */
149303 ** WHERE clause.
149804 " WHERE type='table'AND name<>'sqlite_sequence'"
149811 " WHERE type='index'",
149825 "WHERE type='table'AND coalesce(rootpage,1)>0",
149840 " WHERE type IN('view','trigger')"
150427 "WHERE rowid=#%d",
151297 ** the WHERE clause of SQL statements.
151301 ** that actually generate the bulk of the WHERE loop code. The original where.c
151366 ** loop in WHERE clause.
151475 ** subquery on one operand of an OR operator in the WHERE clause.
151524 ** help it analyze the subexpressions of the WHERE clause. Each WHERE
151552 ** If a term in the WHERE clause does not match either of the two previous
151621 ** terms in the WHERE clause that are useful to the query planner.
151639 ** WHERE clause. Mostly this is a container for one or more WhereTerms.
151641 ** Explanation of pOuter: For a WHERE clause of the form
151650 WhereInfo *pWInfo; /* WHERE clause processing context */
151657 WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */
151687 ** SrcItem.iCursor and Expr.iTable fields. For any given WHERE
151697 ** For example, if the WHERE clause expression used these VDBE
151719 WhereInfo *pWInfo; /* Information about this WHERE */
151720 WhereClause *pWC; /* WHERE clause terms */
151759 ** The WHERE clause processing routine has two halves. The
151760 ** first part does the start of the WHERE loop and the second
151761 ** half does the tail of the WHERE loop. An instance of
151774 Expr *pWhere; /* The complete WHERE clause */
151776 Select *pSelect; /* The entire SELECT statement containing WHERE */
151780 int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */
151788 unsigned untestedTerms :1; /* Not all WHERE terms resolved by outer loop */
151792 int iTop; /* The very beginning of the WHERE loop */
151793 int iEndWhere; /* End of the WHERE clause itself */
151797 WhereClause sWC; /* Decomposition of the WHERE clause */
151799 WhereLevel a[1]; /* Information about each nest loop in WHERE */
151814 WhereClause *pWC, /* The WHERE clause to be searched */
151834 const WhereInfo *pWInfo, /* WHERE clause */
151854 WhereInfo *pWInfo, /* Complete information about the WHERE clause */
151940 #define WHERE_SELFCULL 0x00800000 /* nOut reduced by extra WHERE terms */
152006 ** SELECT * FROM t1 WHERE a=1 AND b>2;
152164 const WhereInfo *pWInfo, /* WHERE clause */
152234 ** Disable a term in the WHERE clause. Except, do not disable the term
152240 ** (1) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok'
152242 ** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'
152264 ** Only the parent term was in the original WHERE clause. The child1
152383 ** SELECT * FROM t1 WHERE (a,b,c,d,e) IN (SELECT v,w,x,y,z FROM t2)
152471 ** Generate code for a single equality term of the WHERE clause. An equality
152487 WhereTerm *pTerm, /* The term of the WHERE clause to be coded */
152625 /* As an optimization, try to disable the WHERE clause term that is
152648 ** Suppose the WHERE clause is this: a==5 AND b IN (1,2,3) AND c>5 AND c<10
152660 ** The nExtraReg parameter is 0 or 1. It is 0 if all WHERE clause constraints
152680 ** SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b;
152752 ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
152865 ** Test whether or not expression pExpr, which was part of a WHERE clause,
152929 /* An aggregate function in the WHERE clause of a query means this must
152982 ** that were specified as part of the WHERE clause must be excluded.
152985 ** SELECT ... t1 LEFT JOIN t2 ON (t1.a=t2.b) WHERE t2.c IS NULL;
152991 ** WHERE clause, and so the query returns a row. Which is incorrect.
152993 ** For the same reason, WHERE terms such as:
152995 ** WHERE 1 = (t2.c IS NULL)
153147 ** The pTruth expression is always true because it is the WHERE clause
153149 ** WHERE clause terms on the query, and if any of those terms must be
153150 ** true because pTruth is true, then mark those WHERE clause terms as
153191 WhereInfo *pWInfo, /* Complete information about the WHERE clause */
153239 ** Generate code for the start of the iLevel-th loop in the WHERE clause
153245 WhereInfo *pWInfo, /* Complete information about the WHERE clause */
153255 WhereClause *pWC; /* Decomposition of the entire WHERE clause */
153256 WhereTerm *pTerm; /* A WHERE clause term */
153274 VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName));
153283 sqlite3DebugPrintf("WHERE clause being coded:\n");
153286 sqlite3DebugPrintf("All WHERE-clause terms before coding:\n");
153598 ** The WHERE clause may contain zero or more equality
153623 ** This case is also used when there are no WHERE clause
153973 /* If a partial index is driving the loop, try to eliminate WHERE clause
153974 ** terms from the query that must be true due to the WHERE clause of
154020 ** SELECT * FROM t1 WHERE a=5 OR b=7 OR (c=11 AND d=13)
154125 /* If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y
154179 /* Run a separate WHERE clause for each term of the OR clause. After
154180 ** eliminating duplicates from other WHERE clauses, the action for each
154181 ** sub-WHERE clause is to to invoke the main loop body as a subroutine.
154216 /* This is the sub-WHERE clause body. First skip over
154217 ** duplicate rows from prior sub-WHERE clauses, and record the
154219 ** row will be skipped in subsequent sub-WHERE clauses.
154272 ** current sub-WHERE row is a duplicate from prior sub-WHEREs. */
154402 /* Defer processing WHERE clause constraints until after outer
154462 ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
154554 goto code_outer_join_constraints; /* WHERE clause constraints */
154571 /* WHERE clause constraints must be deferred until after outer join
154572 ** row elimination has completed, since WHERE clause constraints apply
154574 ** appropriate WHERE clause constraint checks. tag-20220513a.
154594 sqlite3DebugPrintf("All WHERE-clause terms after coding level %d:\n",
154710 ** the WHERE clause of SQL statements.
154714 ** analyzing Expr objects in the WHERE clause.
154793 ** allowed for an indexable WHERE clause term. The allowed operators are
155190 ** Subterms pOne and pTwo are contained within WHERE clause pWC. The
155211 WhereClause *pWC, /* The complete WHERE clause */
155253 ** ... WHERE (a=5) AND (b=7 OR c=9 OR d=13) AND (d=13)
155291 ** WHERE clause of the form "x>=A". Example:
155338 WhereClause *pWC, /* the complete WHERE clause */
155341 WhereInfo *pWInfo = pWC->pWInfo; /* WHERE clause processing context */
155606 ** for the LHS anyplace else in the WHERE clause where the LHS column occurs.
155738 ** term of the form "Y <op> X" is added to the WHERE clause and
155747 WhereClause *pWC, /* the WHERE clause */
155750 WhereInfo *pWInfo = pWC->pWInfo; /* WHERE clause processing context */
155821 ** 3.0 through 3.38 just put the ON clause constraint into the WHERE
156208 ** This routine identifies subexpressions in the WHERE clause where
156213 ** WHERE a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22)
156217 ** The original WHERE clause in pExpr is unaltered. All this routine
156222 ** all terms of the WHERE clause.
156249 WhereClause *pWC, /* Add the constraint to this WHERE clause */
156292 ** 4. There are no terms in the WHERE clause that will not be passed
156349 WhereInfo *pWInfo /* The WHERE processing context */
156481 ** Call exprAnalyze on all terms in a WHERE clause.
156484 ** end of the WHERE clause. We do not want to analyze these new
156490 WhereClause *pWC /* the WHERE clause to be analyzed */
156500 ** new WHERE clause terms.
156563 ** the WHERE clause of SQL statements. This module is responsible for
156597 ** Return the estimated number of output rows from a WHERE clause
156605 ** WHERE clause returns outputs for DISTINCT processing.
156613 ** WHERE clause. A return of 0 means that the output must be
156686 ** immediately with the next row of a WHERE clause.
156695 ** out of a WHERE loop.
156703 ** operate directly on the rowids returned by a WHERE clause. Return
156731 ** Return TRUE if the WHERE loop uses the OP_DeferredSeek opcode to move
156968 ** Initialize a WHERE clause scanner object. Return a pointer to the
156971 ** The scanner will be searching the WHERE clause pWC. It will look
156978 ** If the search is for X and the WHERE clause contains terms of the
156988 WhereClause *pWC, /* The WHERE clause to be scanned */
157026 ** Search for a term in the WHERE clause that is of the form "X <op> <expr>"
157036 ** the WHERE clause that specifies that X=Y. Any such constraints will be
157043 ** If there are multiple terms in the WHERE clause of the form "X <op> <expr>"
157051 WhereClause *pWC, /* The WHERE clause to be searched */
157140 WhereClause *pWC, /* The WHERE clause */
157172 ** list, or else the WHERE clause contains a term of the form "col=X",
157176 ** 3. All of those index columns for which the WHERE clause does not
157305 ** for an example of a WHERE clause constraints that may not be used on
157310 const WhereTerm *pTerm, /* WHERE clause term to check */
157335 ** Return TRUE if the WHERE clause term pTerm is of a form where it
157340 const WhereTerm *pTerm, /* WHERE clause term to check */
157372 const WhereClause *pWC, /* The WHERE clause */
157378 WhereTerm *pTerm; /* A single term of the WHERE clause */
157408 ** and used to match WHERE clause constraints */
157417 ** WHERE clause (or the ON clause of a LEFT join) that constrain which
157605 WhereInfo *pWInfo, /* The WHERE clause */
157613 const WhereTerm *pTerm; /* For looping over WHERE clause terms */
157614 const WhereTerm *pWCEnd; /* Last WHERE clause term */
157718 WhereInfo *pWInfo, /* The WHERE clause */
157719 WhereClause *pWC, /* The WHERE clause being analyzed */
157744 /* Find all WHERE clause constraints referring to this virtual table.
158209 ** SELECT * FROM t1 WHERE a=? AND c BETWEEN ? AND ?;
158314 ** bound, a lower bound, or both. The WHERE clause terms that set the upper
158318 ** ... FROM t1 WHERE a > ? AND a < ? ...
158331 ** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...
158336 ** ... FROM t1 WHERE a > ? AND a < ? ...
158585 ** WHERE x IN (1,2,3,4)
158853 ** (2) X uses fewer WHERE clause terms than Y
158854 ** (3) Every WHERE clause term used by X is also used by Y
158902 ** WHERE clause terms than Y and that every WHERE clause term used by X is
159144 ** WHERE clause that reference the loop but which are not used by an
159147 ** For every WHERE clause term that is not used by the index
159152 ** TUNING: For every WHERE clause term that is not used by the index
159160 ** the WhereLoop.nOut field for every such WHERE clause term.
159162 ** Heuristic 2: If there exists one or more WHERE clause terms of the
159172 WhereClause *pWC, /* The WHERE clause */
159195 /* If there are extra terms in the WHERE clause not used by an index
159251 ** WHERE a = ? AND (b, c, d) > (?, ?, ?)
159340 WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */
159346 WhereScan scan; /* Iterator for WHERE terms */
159396 LogEst nOutUnadjusted; /* nOut before IN() and WHERE adjustments */
159685 /* Consider using a skip-scan if there are no WHERE clause constraints
159772 WhereClause *pWC, /* The WHERE clause of the query */
159773 Expr *pWhere /* The WHERE clause from the partial index */
159856 WhereInfo *pWInfo, /* The WHERE clause context */
159913 ** WHERE clause includes "x IN (....)" terms used in place of "x=?". Or when
159925 WhereLoopBuilder *pBuilder, /* WHERE clause information */
159928 WhereInfo *pWInfo; /* WHERE analysis context */
159940 WhereClause *pWC; /* The parsed WHERE clause */
160133 ** lookups. Take into account WHERE clause terms that can be
160546 WhereLoopBuilder *pBuilder, /* WHERE clause information */
160551 WhereInfo *pWInfo; /* WHERE analysis context */
160553 WhereClause *pWC; /* The WHERE clause */
160784 ** this does not happen. Otherwise, for WHERE clauses such as the
160787 ** WHERE likelihood(x=?, 0.99) OR y=?
160905 WhereInfo *pWInfo, /* The WHERE clause */
160928 WhereTerm *pTerm; /* A single term of the WHERE clause */
160995 ** the current loop for which there is term in the WHERE
162084 ** Generate the beginning of the loop used for WHERE clause processing.
162088 ** in order to complete the WHERE clause processing.
162097 ** SELECT * FROM t1, t2, t3 WHERE ...;
162112 ** the WHERE clause, it might result in additional nested loops for
162125 ** If the WHERE clause is empty, the foreach loops must each scan their
162127 ** the tables have indices and there are terms in the WHERE clause that
162132 ** Terms of the WHERE clause are also used to limit which rows actually
162134 ** terms of the WHERE clause that use only terms in that loop and outer
162165 ** to use for OR clause processing. The WHERE clause should use this
162174 Expr *pWhere, /* The WHERE clause */
162275 /* Split the WHERE clause into separate subexpressions where each
162330 /* Special case: WHERE terms that do not refer to any tables in the join
162338 ** FROM ... WHERE random()>0; -- eval random() once per row
162339 ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall
162385 if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */
162386 sqlite3DebugPrintf("---- WHERE clause at start of analysis:\n");
162489 if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */
162490 sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n");
162748 VdbeModuleComment((v, "Begin WHERE-core"));
162802 ** Generate the end of the WHERE loop. See comments on
162818 VdbeModuleComment((v, "End WHERE-core"));
162893 ** opened yet. This occurs for WHERE clauses such as
162968 VdbeModuleComment((v, "End WHERE-loop%d: %s", i,
163169 ** * FROM, WHERE, GROUP BY and HAVING clauses are all moved to
167603 0, /* WHERE => nothing */
167876 /* 149 */ "WHERE",
168205 /* 152 */ "where_opt ::= WHERE expr",
168207 /* 154 */ "where_opt_ret ::= WHERE expr",
168209 /* 156 */ "where_opt_ret ::= WHERE expr RETURNING selcollist",
168394 /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP",
169116 246, /* (152) where_opt ::= WHERE expr */
169118 267, /* (154) where_opt_ret ::= WHERE expr */
169120 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
169305 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
169526 -2, /* (152) where_opt ::= WHERE expr */
169528 -2, /* (154) where_opt_ret ::= WHERE expr */
169530 -4, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
169715 -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
170418 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
170419 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
170442 case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
171268 case 341: /* filter_clause ::= FILTER LP WHERE expr RP */
172108 ** 119: WHERE
172238 testcase( i==97 ); /* WHERE */
179640 ** SELECT docid FROM ex1 WHERE b MATCH 'one two three';
181448 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
181462 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
183026 "SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s",
185907 ** xBestIndex - Analyze a WHERE and ORDER BY clause.
189450 ** When queried, the query must include a WHERE clause of type:
189658 ** xBestIndex - Analyze a WHERE and ORDER BY clause.
190181 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
190182 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
190188 /* 7 */ "SELECT %s WHERE rowid=?",
190189 /* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1",
190196 "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC",
190198 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?"
190201 /* 14 */ "SELECT count(*) FROM %Q.'%q_segdir' WHERE level = ?",
190202 /* 15 */ "SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
190204 /* 16 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ?",
190205 /* 17 */ "DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?",
190207 /* 19 */ "DELETE FROM %Q.'%q_docsize' WHERE docid = ?",
190209 /* 21 */ "SELECT size FROM %Q.'%q_docsize' WHERE docid=?",
190210 /* 22 */ "SELECT value FROM %Q.'%q_stat' WHERE id=?",
190215 /* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
190232 " WHERE level = ? ORDER BY idx ASC LIMIT ?"
190237 /* 30 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?",
190242 /* 31 */ "UPDATE %Q.'%q_segdir' SET idx = ? WHERE level=? AND idx=?",
190248 "FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?",
190254 "WHERE level = ? AND idx = ?",
190259 /* 34 */ "SELECT 1 FROM %Q.'%q_segments' WHERE blockid=? AND block IS NULL",
190263 /* 35 */ "SELECT idx FROM %Q.'%q_segdir' WHERE level=? ORDER BY 1 ASC",
190271 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? "
190276 "WHERE level=? AND idx=?",
190277 /* 39 */ "UPDATE OR FAIL %Q.'%q_segdir' SET level=? WHERE level=-1"
190499 /* "SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ..." */
190508 /* "SELECT * FROM %_segdir WHERE level = ? ORDER BY ..." */
191004 ** SELECT max(idx) FROM %_segdir WHERE level = :iLevel
192366 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?
192394 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?
194388 ** DELETE FROM %_segdir WHERE level = :iAbsLevel AND idx = :iIdx
194389 ** UPDATE %_segdir SET idx = idx - 1 WHERE level = :iAbsLevel AND idx > :iIdx
204382 const char *zFmt = "SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'";
204466 "DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1",
204469 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1",
204471 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1",
204474 "SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1",
204476 "DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1"
204545 "SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1",
204565 sqlite3_str_appendf(p, " WHERE rowid=?1");
204638 "SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1",
204856 ** SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1;
204986 "SELECT data FROM %Q.'%q_node' WHERE nodeno=?",
205034 "SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1",
205035 "SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1"
208433 ** UPDATE t1 SET c = 'usa' WHERE a = 4;
208453 ** UPDATE t1 SET c = rbu_delta(c, 'usa') WHERE a = 4;
208472 ** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
209797 "WHERE type IN ('table', 'view') AND target IS NOT NULL "
209806 " WHERE type='index' AND tbl_name = ?"
210019 " WHERE name=%Q", zTab
210041 "SELECT rootpage FROM sqlite_schema WHERE name = %Q", zIdx
210297 ** constructs a WHERE clause that can be used to extract the remaining
210298 ** rows from the source table. For a rowid table, the WHERE clause
210301 ** "WHERE _rowid_ > ?"
210305 ** "WHERE (key1, key2) > (?, ?)"
210307 ** Instead of "?" placeholders, the actual WHERE clauses created by
210326 zRet = rbuMPrintf(p, " WHERE _rowid_ > %lld ", iMax);
210343 zRet = rbuMPrintf(p, " WHERE (%s) > (%s) ", zList, zVal);
210359 ** it, then composes and returns an expression that can be used in a WHERE
210497 char **pzWhere, /* OUT: WHERE clause */
210636 ** Return an expression that can be used in a WHERE clause to match the
210662 "_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)", zList
210852 sqlite3_stmt *pQuery = 0; /* SELECT name ... WHERE rootpage = $tnum */
210863 "SELECT name FROM sqlite_schema WHERE rootpage = ?"
211036 "SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?"
211149 char *zWhere = 0; /* WHERE clause on PK columns */
211183 sqlite3_mprintf("DELETE FROM \"rbu_imp_%w\" WHERE %s", zTbl, zWhere)
211205 (zStart ? (zPart ? "AND" : "WHERE") : ""), zStart,
211227 (zPart ? "AND" : "WHERE"),
211279 "DELETE FROM \"%s%w\" WHERE %s", zWrite, zTbl, zWhere
211293 "SELECT *%s FROM '%q' WHERE 0;"
211447 zUpdate = sqlite3_mprintf("UPDATE \"%s%w\" SET %s WHERE %s",
212417 "SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0"
212432 "SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL"
212702 "WHERE type='index' AND tbl_name = %Q", sqlite3_value_text(apVal[0]))
212752 "SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'"
214393 ** 0x01 There is a schema=? term in the WHERE clause
214394 ** 0x02 There is a name=? term in the WHERE clause
214395 ** 0x04 There is an aggregate=? term in the WHERE clause
214960 " FROM \"%w\".sqlite_schema WHERE rootpage!=0)",
214963 sqlite3_str_appendf(pSql, "WHERE name=%Q", zName);
215109 ** SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123;
217173 "SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ("
217174 " SELECT 1 FROM \"%w\".\"%w\" WHERE %s"
217227 "SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)",
217902 ** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ...
217919 "SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
217932 sessionAppendStr(&buf, " WHERE ", &rc);
219311 ** UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ?
219401 /* Create the WHERE clause part of the UPDATE */
219403 sessionAppendStr(&buf, " WHERE ", &rc);
219473 ** DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4)
219495 sessionAppendStr(&buf, " WHERE ", &rc);
219542 ** SELECT * FROM x WHERE a = ?1 AND c = ?3
219616 "DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS "
221492 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
222573 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
230304 sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=?" */
230773 ** DELETE FROM %_data WHERE id BETWEEN $iFirst AND $iLast
230781 "DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?",
230803 "DELETE FROM '%q'.'%q_idx' WHERE segid=?",
232417 "SELECT pgno FROM '%q'.'%q_idx' WHERE "
236099 "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d "
236987 ** WHERE clause in the user's query might have been:
237316 ** WHERE constraint, it searches for the following:
237338 ** idxStr is used to encode data from the WHERE clause. For each argument
237355 ** a) If an unusable MATCH operator is present in the WHERE clause, the
239828 "SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC",
239829 "SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC",
239830 "SELECT %s FROM %s T WHERE T.%Q=?", /* LOOKUP */
239834 "DELETE FROM %Q.'%q_content' WHERE id=?", /* DELETE_CONTENT */
239836 "DELETE FROM %Q.'%q_docsize' WHERE id=?", /* DELETE_DOCSIZE */
239838 "SELECT sz FROM %Q.'%q_docsize' WHERE id=?", /* LOOKUP_DOCSIZE */
243808 "SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'",
246132 sql = sqlite3_mprintf("SELECT 'CREATE TABLE %s.' || substr(sql,14) FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence' AND rootpage>0;", dbName);
246142 sql = sqlite3_mprintf("SELECT 'CREATE INDEX %s.' || substr(sql,14) FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %%';", dbName);
246152 sql = sqlite3_mprintf("SELECT 'CREATE UNIQUE INDEX %s.' || substr(sql,21) FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %%';", dbName);
246162 sql = sqlite3_mprintf("SELECT 'INSERT INTO %s.' || quote(name) || ' SELECT * FROM main.' || quote(name) || ';' FROM main.sqlite_master WHERE type = 'table' AND name!='sqlite_sequence' AND rootpage>0;", dbName);
246172 sql = sqlite3_mprintf("SELECT 'DELETE FROM %s.' || quote(name) || ';' FROM %s.sqlite_master WHERE name='sqlite_sequence';", dbName, dbName);
246182 sql = sqlite3_mprintf("SELECT 'INSERT INTO %s.' || quote(name) || ' SELECT * FROM main.' || quote(name) || ';' FROM %s.sqlite_master WHERE name=='sqlite_sequence';", dbName, dbName);
246192 sql = sqlite3_mprintf("INSERT INTO %s.sqlite_master SELECT type, name, tbl_name, rootpage, sql FROM main.sqlite_master WHERE type='view' OR type='trigger' OR (type='table' AND rootpage=0);", dbName, dbName);