SQLite

Check-in [33996983]
Login

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

Overview
Comment:When the database encoding is UTF-16LE and the GLOB optimization is used, it is ok to use the range search over an index, but it is not ok to disable the actual GLOB function call.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3399698376761ab8c422f8ea02bfa2759afb606f08bedbd1cf7eee834229a9aa
User & Date: drh 2024-08-20 14:12:16
Context
2024-08-20
23:11
Refactor the SrcItem object to move fields associated with subqueries out into a separate object named Subquery. This reduces the size of the SrcItem object by about 1/3rd and provides improved performance. (check-in: 484bcd75 user: drh tags: trunk)
14:16
When the database encoding is UTF-16LE and the GLOB optimization is used, it is ok to use the range search over an index, but it is not ok to disable the actual GLOB function call. (check-in: db917d50 user: drh tags: branch-3.46)
14:12
When the database encoding is UTF-16LE and the GLOB optimization is used, it is ok to use the range search over an index, but it is not ok to disable the actual GLOB function call. (check-in: 33996983 user: drh tags: trunk)
12:09
Fix for the UTF-16LE problem reporte by forum post dc7e1b7527e84343. Because of the unexpected ordering of characters using the default collation (memcmp() order) in UTF-16LE, the LIKE/GLOB optimization restricts its attention to the pattern prefix that is all ASCII, which is the common case. (check-in: a5797ebd user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/whereexpr.c.

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
    ** range search. The third is because the caller assumes that the pattern
    ** consists of at least one character after all escapes have been
    ** removed.  */
    if( (cnt>1 || (cnt>0 && z[0]!=wc[3])) && 255!=(u8)z[cnt-1] ){
      Expr *pPrefix;

      /* A "complete" match if the pattern ends with "*" or "%" */
      *pisComplete = c==wc[0] && z[cnt+1]==0;

      /* Get the pattern prefix.  Remove all escapes from the prefix. */
      pPrefix = sqlite3Expr(db, TK_STRING, (char*)z);
      if( pPrefix ){
        int iFrom, iTo;
        char *zNew;
        assert( !ExprHasProperty(pPrefix, EP_IntValue) );







|







244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
    ** range search. The third is because the caller assumes that the pattern
    ** consists of at least one character after all escapes have been
    ** removed.  */
    if( (cnt>1 || (cnt>0 && z[0]!=wc[3])) && 255!=(u8)z[cnt-1] ){
      Expr *pPrefix;

      /* A "complete" match if the pattern ends with "*" or "%" */
      *pisComplete = c==wc[0] && z[cnt+1]==0 && ENC(db)!=SQLITE_UTF16LE;

      /* Get the pattern prefix.  Remove all escapes from the prefix. */
      pPrefix = sqlite3Expr(db, TK_STRING, (char*)z);
      if( pPrefix ){
        int iFrom, iTo;
        char *zNew;
        assert( !ExprHasProperty(pPrefix, EP_IntValue) );