/ Check-in [f97626f9]
Login

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

Overview
Comment:Small performance increase and size reduction in the implementation of the LIKE and GLOB operators.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f97626f921dafe596b615a168ef31987f4a1c0b52956443e1a5c1148b49cab74
User & Date: drh 2019-04-30 11:54:36
Context
2019-04-30
14:26
Fix an error message in the Lemon parser generator. check-in: b6d7d42b user: drh tags: trunk
11:54
Small performance increase and size reduction in the implementation of the LIKE and GLOB operators. check-in: f97626f9 user: drh tags: trunk
01:08
Slightly smaller and faster implementation of the OP_MakeRecord opcode. check-in: 3bdce7ef user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/func.c.

   839    839   #ifdef SQLITE_TEST
   840    840       sqlite3_like_count++;
   841    841   #endif
   842    842       sqlite3_result_int(context, 0);
   843    843       return;
   844    844     }
   845    845   #endif
   846         -  zB = sqlite3_value_text(argv[0]);
   847         -  zA = sqlite3_value_text(argv[1]);
   848    846   
   849    847     /* Limit the length of the LIKE or GLOB pattern to avoid problems
   850    848     ** of deep recursion and N*N behavior in patternCompare().
   851    849     */
   852    850     nPat = sqlite3_value_bytes(argv[0]);
   853    851     testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] );
   854    852     testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 );
   855    853     if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){
   856    854       sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1);
   857    855       return;
   858    856     }
   859         -  assert( zB==sqlite3_value_text(argv[0]) );  /* Encoding did not change */
   860         -
   861    857     if( argc==3 ){
   862    858       /* The escape character string must consist of a single UTF-8 character.
   863    859       ** Otherwise, return an error.
   864    860       */
   865    861       const unsigned char *zEsc = sqlite3_value_text(argv[2]);
   866    862       if( zEsc==0 ) return;
   867    863       if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
................................................................................
   869    865             "ESCAPE expression must be a single character", -1);
   870    866         return;
   871    867       }
   872    868       escape = sqlite3Utf8Read(&zEsc);
   873    869     }else{
   874    870       escape = pInfo->matchSet;
   875    871     }
          872  +  zB = sqlite3_value_text(argv[0]);
          873  +  zA = sqlite3_value_text(argv[1]);
   876    874     if( zA && zB ){
   877    875   #ifdef SQLITE_TEST
   878    876       sqlite3_like_count++;
   879    877   #endif
   880    878       sqlite3_result_int(context,
   881    879                         patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH);
   882    880     }