Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment:  Improved comments. No code changes. 

Downloads:  Tarball  ZIP archive  SQL archive 
Timelines:  family  ancestors  descendants  both  combinedisjuncts 
Files:  files  file ages  folders 
SHA1: 
23f71a26386ff2aff9800fe96cec1dc9 
User & Date:  drh 20150316 13:12:34 
Context
20150316
 
17:48  When the WHERE clause contains two ORconnected terms with identical operands but different operators, try to combine them into a single term. Example: (X=A OR X>A) becomes (X>=A). checkin: 8bdda827 user: drh tags: trunk  
13:12  Improved comments. No code changes. ClosedLeaf checkin: 23f71a26 user: drh tags: combinedisjuncts  
12:13  When a WHERE clause contains disjuncts with the same operands, try to combine them into a single operator. Example: (x=A OR x>A) becomes (x>=A). checkin: 7a309768 user: drh tags: combinedisjuncts  
Changes
Changes to src/where.c.
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
...
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896

/* ** Subterms pOne and pTwo are contained within WHERE clause pWC. The ** two subterms are in disjunction  they are ORed together. ** ** If these two terms are both of the form: "A op B" with the same ** A and B values but different operators and if the operators are ** compatible (if one is = and the other is <, for example) then ** add a new virtual term to pWC that is the combination of the ** two. ** ** Some examples: ** ** x<y OR x=y > x<=y ** x=y OR x=y > x=y ** x<=y OR x<y > x<=y ................................................................................ ** ** then create a new virtual term like this: ** ** x IN (expr1,expr2,expr3) ** ** CASE 2: ** ** If there is a twoway OR and one side has x>A and the other side ** has x=A (for the same x and A) then add a new virtual term to the ** WHERE clause of the form "x>=A". ** ** CASE 3: ** ** If all subterms are indexable by a single table T, then set ** ** WhereTerm.eOperator = WO_OR ** WhereTerm.u.pOrInfo>indexable = the cursor number for table T 




>
>
>
>

788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
...
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900

/* ** Subterms pOne and pTwo are contained within WHERE clause pWC. The ** two subterms are in disjunction  they are ORed together. ** ** If these two terms are both of the form: "A op B" with the same ** A and B values but different operators and if the operators are ** compatible (if one is = and the other is <, for example) then ** add a new virtual AND term to pWC that is the combination of the ** two. ** ** Some examples: ** ** x<y OR x=y > x<=y ** x=y OR x=y > x=y ** x<=y OR x<y > x<=y ................................................................................ ** ** then create a new virtual term like this: ** ** x IN (expr1,expr2,expr3) ** ** CASE 2: ** ** If there are exactly two disjuncts one side has x>A and the other side ** has x=A (for the same x and A) then add a new virtual conjunct term to the ** WHERE clause of the form "x>=A". Example: ** ** x>A OR (x=A AND y>B) adds: x>=A ** ** The added conjunct can sometimes be helpful in query planning. ** ** CASE 3: ** ** If all subterms are indexable by a single table T, then set ** ** WhereTerm.eOperator = WO_OR ** WhereTerm.u.pOrInfo>indexable = the cursor number for table T 