/ Check-in [b2c89ef4]
Login

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

Overview
Comment:Size reduction and performance improvement in the LIKE and GLOB operators.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b2c89ef49cd19b8031a8149a2dc47cea07dd04e0
User & Date: drh 2014-09-25 00:56:00
Context
2014-09-25
02:44
Change that might allow SQLite to build and work using the EBCDIC character set. check-in: ef30e035 user: drh tags: trunk
00:56
Size reduction and performance improvement in the LIKE and GLOB operators. check-in: b2c89ef4 user: drh tags: trunk
2014-09-24
19:47
Have each open database allocate its pTmpSpace when the first write cursor is opened, rather than on each insert or delete, for a small space savings and performance boost. check-in: 99323552 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/func.c.

   618    618     u32 c, c2;
   619    619     int invert;
   620    620     int seen;
   621    621     u8 matchOne = pInfo->matchOne;
   622    622     u8 matchAll = pInfo->matchAll;
   623    623     u8 matchSet = pInfo->matchSet;
   624    624     u8 noCase = pInfo->noCase; 
   625         -  int prevEscape = 0;     /* True if the previous character was 'escape' */
   626    625   
   627    626     while( (c = sqlite3Utf8Read(&zPattern))!=0 ){
   628         -    if( c==matchAll && !prevEscape ){
          627  +    if( c==matchAll ){
   629    628         while( (c=sqlite3Utf8Read(&zPattern)) == matchAll
   630    629                  || c == matchOne ){
   631    630           if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
   632    631             return 0;
   633    632           }
   634    633         }
   635    634         if( c==0 ){
................................................................................
   660    659               c2 = sqlite3Utf8Read(&zString);
   661    660             }
   662    661           }
   663    662           if( c2==0 ) return 0;
   664    663           if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;
   665    664         }
   666    665         return 0;
   667         -    }else if( c==matchOne && !prevEscape ){
          666  +    }else if( c==matchOne ){
   668    667         if( sqlite3Utf8Read(&zString)==0 ){
   669    668           return 0;
   670    669         }
   671    670       }else if( c==matchSet ){
   672    671         u32 prior_c = 0;
   673    672         assert( esc==0 );    /* This only occurs for GLOB, not LIKE */
   674    673         seen = 0;
................................................................................
   696    695             prior_c = c2;
   697    696           }
   698    697           c2 = sqlite3Utf8Read(&zPattern);
   699    698         }
   700    699         if( c2==0 || (seen ^ invert)==0 ){
   701    700           return 0;
   702    701         }
   703         -    }else if( esc==c && !prevEscape ){
   704         -      prevEscape = 1;
   705    702       }else{
   706    703         c2 = sqlite3Utf8Read(&zString);
          704  +      if( c==esc ){
          705  +        c = sqlite3Utf8Read(&zPattern);
          706  +      }
   707    707         if( noCase ){
   708    708           GlobUpperToLower(c);
   709    709           GlobUpperToLower(c2);
   710    710         }
   711    711         if( c!=c2 ){
   712    712           return 0;
   713    713         }
   714         -      prevEscape = 0;
   715    714       }
   716    715     }
   717    716     return *zString==0;
   718    717   }
   719    718   
   720    719   /*
   721    720   ** The sqlite3_strglob() interface.