mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
58
third_party/sqlite3/whereexpr.c
vendored
58
third_party/sqlite3/whereexpr.c
vendored
|
@ -262,8 +262,8 @@ static int isLikeOrGlob(
|
|||
** 2019-06-14 https://sqlite.org/src/info/ce8717f0885af975
|
||||
** 2019-09-03 https://sqlite.org/src/info/0f0428096f17252a
|
||||
*/
|
||||
if( pLeft->op!=TK_COLUMN
|
||||
|| sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
|
||||
if( pLeft->op!=TK_COLUMN
|
||||
|| sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
|
||||
|| IsVirtual(pLeft->y.pTab) /* Value might be numeric */
|
||||
){
|
||||
int isNum;
|
||||
|
@ -298,7 +298,7 @@ static int isLikeOrGlob(
|
|||
** function, then no OP_Variable will be added to the program.
|
||||
** This causes problems for the sqlite3_bind_parameter_name()
|
||||
** API. To work around them, add a dummy OP_Variable here.
|
||||
*/
|
||||
*/
|
||||
int r1 = sqlite3GetTempReg(pParse);
|
||||
sqlite3ExprCodeTarget(pParse, pRight, r1);
|
||||
sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);
|
||||
|
@ -335,7 +335,7 @@ static int isLikeOrGlob(
|
|||
** 9. column IS NOT NULL SQLITE_INDEX_CONSTRAINT_ISNOTNULL
|
||||
**
|
||||
** In every case, "column" must be a column of a virtual table. If there
|
||||
** is a match, set *ppLeft to the "column" expression, set *ppRight to the
|
||||
** is a match, set *ppLeft to the "column" expression, set *ppRight to the
|
||||
** "expr" expression (even though in forms (6) and (8) the column is on the
|
||||
** right and the expression is on the left). Also set *peOp2 to the
|
||||
** appropriate virtual table operator. The return value is 1 or 2 if there
|
||||
|
@ -498,7 +498,7 @@ static WhereTerm *whereNthSubterm(WhereTerm *pTerm, int N){
|
|||
**
|
||||
** The following is NOT generated:
|
||||
**
|
||||
** x<y OR x>y --> x!=y
|
||||
** x<y OR x>y --> x!=y
|
||||
*/
|
||||
static void whereCombineDisjuncts(
|
||||
SrcList *pSrc, /* the FROM clause */
|
||||
|
@ -596,10 +596,10 @@ static void whereCombineDisjuncts(
|
|||
** WhereTerm.u.pOrInfo->indexable |= the cursor number for table T
|
||||
**
|
||||
** A subterm is "indexable" if it is of the form
|
||||
** "T.C <op> <expr>" where C is any column of table T and
|
||||
** "T.C <op> <expr>" where C is any column of table T and
|
||||
** <op> is one of "=", "<", "<=", ">", ">=", "IS NULL", or "IN".
|
||||
** A subterm is also indexable if it is an AND of two or more
|
||||
** subsubterms at least one of which is indexable. Indexable AND
|
||||
** subsubterms at least one of which is indexable. Indexable AND
|
||||
** subterms have their eOperator set to WO_AND and they have
|
||||
** u.pAndInfo set to a dynamically allocated WhereAndTerm object.
|
||||
**
|
||||
|
@ -690,7 +690,7 @@ static void exprAnalyzeOrTerm(
|
|||
if( !db->mallocFailed ){
|
||||
for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){
|
||||
assert( pAndTerm->pExpr );
|
||||
if( allowedOp(pAndTerm->pExpr->op)
|
||||
if( allowedOp(pAndTerm->pExpr->op)
|
||||
|| pAndTerm->eOperator==WO_AUX
|
||||
){
|
||||
b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor);
|
||||
|
@ -793,7 +793,7 @@ static void exprAnalyzeOrTerm(
|
|||
pOrTerm->leftCursor))==0 ){
|
||||
/* This term must be of the form t1.a==t2.b where t2 is in the
|
||||
** chngToIN set but t1 is not. This term will be either preceded
|
||||
** or follwed by an inverted copy (t2.b==t1.a). Skip this term
|
||||
** or follwed by an inverted copy (t2.b==t1.a). Skip this term
|
||||
** and use its inversion. */
|
||||
testcase( pOrTerm->wtFlags & TERM_COPIED );
|
||||
testcase( pOrTerm->wtFlags & TERM_VIRTUAL );
|
||||
|
@ -822,7 +822,7 @@ static void exprAnalyzeOrTerm(
|
|||
assert( pOrTerm->eOperator & WO_EQ );
|
||||
if( pOrTerm->leftCursor!=iCursor ){
|
||||
pOrTerm->wtFlags &= ~TERM_OR_OK;
|
||||
}else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR
|
||||
}else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR
|
||||
&& sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1)
|
||||
)){
|
||||
okToChngToIN = 0;
|
||||
|
@ -844,7 +844,7 @@ static void exprAnalyzeOrTerm(
|
|||
}
|
||||
|
||||
/* At this point, okToChngToIN is true if original pTerm satisfies
|
||||
** case 1. In that case, construct a new virtual term that is
|
||||
** case 1. In that case, construct a new virtual term that is
|
||||
** pTerm converted into an IN operator.
|
||||
*/
|
||||
if( okToChngToIN ){
|
||||
|
@ -989,8 +989,8 @@ static int exprMightBeIndexed(
|
|||
Expr *pExpr, /* An operand of a comparison operator */
|
||||
int op /* The specific comparison operator */
|
||||
){
|
||||
/* If this expression is a vector to the left or right of a
|
||||
** inequality constraint (>, <, >= or <=), perform the processing
|
||||
/* If this expression is a vector to the left or right of a
|
||||
** inequality constraint (>, <, >= or <=), perform the processing
|
||||
** on the first element of the vector. */
|
||||
assert( TK_GT+1==TK_LE && TK_GT+2==TK_LT && TK_GT+3==TK_GE );
|
||||
assert( TK_IS<TK_GE && TK_ISNULL<TK_GE && TK_IN<TK_GE );
|
||||
|
@ -1133,7 +1133,7 @@ static int exprExistsToInIter(struct ExistsToInCtx *p, Expr **ppExpr){
|
|||
** 1. Exactly one of the AND separated terms refers to the outer
|
||||
** query, and it is an == (TK_EQ) expression.
|
||||
**
|
||||
** 2. Only one side of the == expression refers to the outer query, and
|
||||
** 2. Only one side of the == expression refers to the outer query, and
|
||||
** it does not refer to any columns from the inner query.
|
||||
**
|
||||
** If both these conditions are true, then a pointer to the side of the ==
|
||||
|
@ -1167,7 +1167,7 @@ static Expr *exprAnalyzeExistsFindEq(
|
|||
** Term idxTerm of the WHERE clause passed as the second argument is an
|
||||
** EXISTS expression with a correlated SELECT statement on the RHS.
|
||||
** This function analyzes the SELECT statement, and if possible adds an
|
||||
** equivalent "? IN(SELECT...)" virtual term to the WHERE clause.
|
||||
** equivalent "? IN(SELECT...)" virtual term to the WHERE clause.
|
||||
**
|
||||
** For an EXISTS term such as the following:
|
||||
**
|
||||
|
@ -1184,7 +1184,7 @@ static Expr *exprAnalyzeExistsFindEq(
|
|||
** 2. The sub-select must not be a compound SELECT,
|
||||
**
|
||||
** 3. Expression <e1> must refer to at least one column from the outer
|
||||
** query, and must not refer to any column from the inner query
|
||||
** query, and must not refer to any column from the inner query
|
||||
** (i.e. from <srclist>).
|
||||
**
|
||||
** 4. <e2> and <e3> must not refer to any values from the outer query.
|
||||
|
@ -1307,8 +1307,8 @@ static void exprAnalyze(
|
|||
WhereTerm *pTerm; /* The term to be analyzed */
|
||||
WhereMaskSet *pMaskSet; /* Set of table index masks */
|
||||
Expr *pExpr; /* The expression to be analyzed */
|
||||
Bitmask prereqLeft; /* Prerequisites of the pExpr->pLeft */
|
||||
Bitmask prereqAll; /* Prerequisites of pExpr */
|
||||
Bitmask prereqLeft; /* Prerequesites of the pExpr->pLeft */
|
||||
Bitmask prereqAll; /* Prerequesites of pExpr */
|
||||
Bitmask extraRight = 0; /* Extra dependencies on LEFT JOIN */
|
||||
Expr *pStr1 = 0; /* RHS of LIKE/GLOB operator */
|
||||
int isComplete = 0; /* RHS of LIKE/GLOB ends with wildcard */
|
||||
|
@ -1376,7 +1376,7 @@ static void exprAnalyze(
|
|||
pTerm->eOperator = operatorMask(op) & opMask;
|
||||
}
|
||||
if( op==TK_IS ) pTerm->wtFlags |= TERM_IS;
|
||||
if( pRight
|
||||
if( pRight
|
||||
&& exprMightBeIndexed(pSrc, pTerm->prereqRight, aiCurCol, pRight, op)
|
||||
){
|
||||
WhereTerm *pNew;
|
||||
|
@ -1447,7 +1447,7 @@ static void exprAnalyze(
|
|||
for(i=0; i<2; i++){
|
||||
Expr *pNewExpr;
|
||||
int idxNew;
|
||||
pNewExpr = sqlite3PExpr(pParse, ops[i],
|
||||
pNewExpr = sqlite3PExpr(pParse, ops[i],
|
||||
sqlite3ExprDup(db, pExpr->pLeft, 0),
|
||||
sqlite3ExprDup(db, pList->a[i].pExpr, 0));
|
||||
transferJoinMarkings(pNewExpr, pExpr);
|
||||
|
@ -1495,11 +1495,11 @@ static void exprAnalyze(
|
|||
Expr *pLeft = pExpr->pLeft;
|
||||
int idxNew;
|
||||
WhereTerm *pNewTerm;
|
||||
|
||||
|
||||
pNewExpr = sqlite3PExpr(pParse, TK_GT,
|
||||
sqlite3ExprDup(db, pLeft, 0),
|
||||
sqlite3ExprAlloc(db, TK_NULL, 0, 0));
|
||||
|
||||
|
||||
idxNew = whereClauseInsert(pWC, pNewExpr,
|
||||
TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL);
|
||||
if( idxNew ){
|
||||
|
@ -1568,7 +1568,7 @@ static void exprAnalyze(
|
|||
if( noCase ){
|
||||
/* The point is to increment the last character before the first
|
||||
** wildcard. But if we increment '@', that will push it into the
|
||||
** alphabetic range where case conversions will mess up the
|
||||
** alphabetic range where case conversions will mess up the
|
||||
** inequality. To avoid this, make sure to also run the full
|
||||
** LIKE on all candidate expressions by clearing the isComplete flag
|
||||
*/
|
||||
|
@ -1612,7 +1612,7 @@ static void exprAnalyze(
|
|||
if( (pExpr->op==TK_EQ || pExpr->op==TK_IS)
|
||||
&& (nLeft = sqlite3ExprVectorSize(pExpr->pLeft))>1
|
||||
&& sqlite3ExprVectorSize(pExpr->pRight)==nLeft
|
||||
&& ( (pExpr->pLeft->flags & EP_xIsSelect)==0
|
||||
&& ( (pExpr->pLeft->flags & EP_xIsSelect)==0
|
||||
|| (pExpr->pRight->flags & EP_xIsSelect)==0)
|
||||
&& pWC->op==TK_AND
|
||||
){
|
||||
|
@ -1635,7 +1635,7 @@ static void exprAnalyze(
|
|||
|
||||
/* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create
|
||||
** a virtual term for each vector component. The expression object
|
||||
** used by each such virtual term is pExpr (the full vector IN(...)
|
||||
** used by each such virtual term is pExpr (the full vector IN(...)
|
||||
** expression). The WhereTerm.u.x.iField variable identifies the index within
|
||||
** the vector on the LHS that the virtual term represents.
|
||||
**
|
||||
|
@ -1683,7 +1683,7 @@ static void exprAnalyze(
|
|||
prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft);
|
||||
if( (prereqExpr & prereqColumn)==0 ){
|
||||
Expr *pNewExpr;
|
||||
pNewExpr = sqlite3PExpr(pParse, TK_MATCH,
|
||||
pNewExpr = sqlite3PExpr(pParse, TK_MATCH,
|
||||
0, sqlite3ExprDup(db, pRight, 0));
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){
|
||||
ExprSetProperty(pNewExpr, EP_FromJoin);
|
||||
|
@ -1839,7 +1839,7 @@ Bitmask sqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprList *pList){
|
|||
|
||||
|
||||
/*
|
||||
** Call exprAnalyze on all terms in a WHERE clause.
|
||||
** Call exprAnalyze on all terms in a WHERE clause.
|
||||
**
|
||||
** Note that exprAnalyze() might add new virtual terms onto the
|
||||
** end of the WHERE clause. We do not want to analyze these new
|
||||
|
@ -1858,7 +1858,7 @@ void sqlite3WhereExprAnalyze(
|
|||
|
||||
/*
|
||||
** For table-valued-functions, transform the function arguments into
|
||||
** new WHERE clause terms.
|
||||
** new WHERE clause terms.
|
||||
**
|
||||
** Each function argument translates into an equality constraint against
|
||||
** a HIDDEN column in the table.
|
||||
|
@ -1891,7 +1891,7 @@ void sqlite3WhereTabFuncArgs(
|
|||
pColRef->iTable = pItem->iCursor;
|
||||
pColRef->iColumn = k++;
|
||||
pColRef->y.pTab = pTab;
|
||||
pRhs = sqlite3PExpr(pParse, TK_UPLUS,
|
||||
pRhs = sqlite3PExpr(pParse, TK_UPLUS,
|
||||
sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
|
||||
pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
|
||||
if( pItem->fg.jointype & JT_LEFT ){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue