mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Special handling of the NULL keyword. Sometimes it is a literal, and sometimes
it is a keyword. FossilOrigin-Name: db5d138e97f22ad4d4d11dbef96df93696ba0e557809066bc263ca3c3898f349
This commit is contained in:
@ -573,6 +573,17 @@ char *sqlite3_normalize(const char *zSql){
|
||||
}
|
||||
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]);
|
||||
|
Reference in New Issue
Block a user