SQLite

Check-in [db917d50]
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 | branch-3.46
Files: files | file ages | folders
SHA3-256: db917d50fda6eb7ba50dfebbf56ffdc7a97411e35f19733166ecd97a62573054
User & Date: drh 2024-08-20 14:16:26
Context
2024-08-24
17:37
Avoid a stack overflow that could be caused by a recursively defined WINDOW() with a strategically embedded error. (check-in: 07400271 user: drh tags: branch-3.46)
2024-08-20
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:15
The LIKE/GLOB optimization restricts its attention to the pattern prefix that is all ASCII. (check-in: 5815f132 user: drh tags: branch-3.46)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/whereexpr.c.
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
    ** 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) );







|







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
    ** 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) );