/ Check-in [db5d138e]
Login

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

Overview
Comment:Special handling of the NULL keyword. Sometimes it is a literal, and sometimes it is a keyword.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | normalize
Files: files | file ages | folders
SHA3-256: db5d138e97f22ad4d4d11dbef96df93696ba0e557809066bc263ca3c3898f349
User & Date: drh 2018-01-08 19:29:28
Context
2018-01-08
20:04
Test cases for sqlite3_normalize(). Closed-Leaf check-in: 658f4225 user: drh tags: normalize
19:29
Special handling of the NULL keyword. Sometimes it is a literal, and sometimes it is a keyword. check-in: db5d138e user: drh tags: normalize
19:18
Add IN-operator normalizating and the SQLITE_NORMALIZE_CLI compile-time option for generating a stand-alone program. check-in: d77dbb39 user: drh tags: normalize
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/misc/normalize.c.

569
570
571
572
573
574
575











576
577
578
579
580
581
582
      }
      case TK_LITERAL: {
        z[j++] = '?';
        break;
      }
      case TK_PUNCT:
      case TK_NAME: {











        if( j>0 && IdChar(z[j-1]) && IdChar(zSql[i]) ) z[j++] = ' ';
        for(k=0; k<n; k++){
          z[j++] = sqlite3Tolower(zSql[i+k]);
        }
        break;
      }
    }







>
>
>
>
>
>
>
>
>
>
>







569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
      }
      case TK_LITERAL: {
        z[j++] = '?';
        break;
      }
      case TK_PUNCT:
      case TK_NAME: {
        if( n==4 && sqlite3_strnicmp(zSql+i,"NULL",4)==0 ){
          if( (j>=3 && strncmp(z+j-2,"is",2)==0 && !IdChar(z[j-3]))
           || (j>=4 && strncmp(z+j-3,"not",3)==0 && !IdChar(z[j-4]))
          ){
            /* NULL is a keyword in this case, not a literal value */
          }else{
            /* Here the NULL is a literal value */
            z[j++] = '?';
            break;
          }
        }
        if( j>0 && IdChar(z[j-1]) && IdChar(zSql[i]) ) z[j++] = ' ';
        for(k=0; k<n; k++){
          z[j++] = sqlite3Tolower(zSql[i+k]);
        }
        break;
      }
    }