SQLite

Check-in [4d336d7420]
Login

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

Overview
Comment:Speed up wildcard searches in LIKE using strchr()
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | like-compare-opt
Files: files | file ages | folders
SHA3-256: 4d336d742043af1f520eff3f462bdb3db495d3045a81a987c3890e7de09bcc00
User & Date: drh 2017-10-30 18:26:59.234
Context
2017-10-30
18:26
Speed up wildcard searches in LIKE using strchr() (Closed-Leaf check-in: 4d336d7420 user: drh tags: like-compare-opt)
2017-10-28
20:54
Increase the version number for the next release - which is still months away but there have been significant query planner enhancements since the previous release. (check-in: 457eedfac0 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/func.c.
702
703
704
705
706
707
708












709
710
711
712
713

714
715
716
717
718
719
720
        int bMatch;
        if( noCase ){
          cx = sqlite3Toupper(c);
          c = sqlite3Tolower(c);
        }else{
          cx = c;
        }












        while( (c2 = *(zString++))!=0 ){
          if( c2!=c && c2!=cx ) continue;
          bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
          if( bMatch!=SQLITE_NOMATCH ) return bMatch;
        }

      }else{
        int bMatch;
        while( (c2 = Utf8Read(zString))!=0 ){
          if( c2!=c ) continue;
          bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
          if( bMatch!=SQLITE_NOMATCH ) return bMatch;
        }







>
>
>
>
>
>
>
>
>
>
>
>





>







702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
        int bMatch;
        if( noCase ){
          cx = sqlite3Toupper(c);
          c = sqlite3Tolower(c);
        }else{
          cx = c;
        }
        while(1){
          const u8 *zStr1 = (const u8*)strchr((const char*)zString,c);
          if( cx!=c ){
            const u8 *zStr2 = (const u8*)strchr((const char*)zString,cx);
            if( zStr1==0 || (zStr2!=0 && zStr2<zStr1) ) zStr1 = zStr2;
          }
          if( zStr1==0 ) break;
          zString = &zStr1[1];
          bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
          if( bMatch!=SQLITE_NOMATCH ) return bMatch;
        }
#if 0
        while( (c2 = *(zString++))!=0 ){
          if( c2!=c && c2!=cx ) continue;
          bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
          if( bMatch!=SQLITE_NOMATCH ) return bMatch;
        }
#endif
      }else{
        int bMatch;
        while( (c2 = Utf8Read(zString))!=0 ){
          if( c2!=c ) continue;
          bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
          if( bMatch!=SQLITE_NOMATCH ) return bMatch;
        }