SQLite

Changes On Branch OR-clause-improvement
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch OR-clause-improvement Excluding Merge-Ins

This is equivalent to a diff from 2910ef64 to ab946039

2016-01-29
18:11
Avoid unnecessary WHERE clause term tests when coding a join where one of the tables contains a OR constraint. (check-in: 512caa1a user: drh tags: trunk)
16:57
Avoid unnecessary WHERE clause term tests when coding a join where one of the tables contains a OR constraint. (Closed-Leaf check-in: ab946039 user: drh tags: OR-clause-improvement)
08:38
Avoid two more instances of pointer arithmetic on freed pointers. (check-in: 2910ef64 user: dan tags: trunk)
2016-01-28
18:22
Modify the order of terms in an "if" condition to avoid implicitly comparing a dangling pointer to NULL following an OOM error. (check-in: 5372f800 user: dan tags: trunk)

Changes to src/wherecode.c.

1397
1398
1399
1400
1401
1402
1403
1404



1405
1406
1407
1408
1409
1410
1411
1397
1398
1399
1400
1401
1402
1403

1404
1405
1406
1407
1408
1409
1410
1411
1412
1413







-
+
+
+







    */
    if( pWC->nTerm>1 ){
      int iTerm;
      for(iTerm=0; iTerm<pWC->nTerm; iTerm++){
        Expr *pExpr = pWC->a[iTerm].pExpr;
        if( &pWC->a[iTerm] == pTerm ) continue;
        if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;
        if( (pWC->a[iTerm].wtFlags & TERM_VIRTUAL)!=0 ) continue;
        testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
        testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
        if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
        if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
        testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
        pExpr = sqlite3ExprDup(db, pExpr, 0);
        pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
      }
      if( pAndExpr ){
        pAndExpr = sqlite3PExpr(pParse, TK_AND|TKFLG_DONTFOLD, 0, pAndExpr, 0);