diff options
author | drh <drh@noemail.net> | 2019-08-06 14:37:24 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-08-06 14:37:24 +0000 |
commit | 96fb16eecdf03c1042a19bb6aaf46eededb6c75f (patch) | |
tree | 7c5180007167a8a899e8e4e17c0e51d41ad47268 /src/wherecode.c | |
parent | 5978a7a525c58e1402b87ba957d287f650e0f9ab (diff) | |
download | sqlite-96fb16eecdf03c1042a19bb6aaf46eededb6c75f.tar.gz sqlite-96fb16eecdf03c1042a19bb6aaf46eededb6c75f.zip |
Use 0x40 (ASCII '@') instead of 0x00 to mean "no affinity" so that columns
with no affinity can appear in a zero-terminated string. Use the new
SQLITE_AFF_NONE macro for this new magic number.
FossilOrigin-Name: e8234f6939ccff4c10f741cf66d1c537cfebcbd0d1d79a618a64c755a7f087b5
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index a6cfdb04f..c781b06c1 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -318,9 +318,9 @@ static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){ ** Code an OP_Affinity opcode to apply the column affinity string zAff ** to the n registers starting at base. ** -** As an optimization, SQLITE_AFF_BLOB entries (which are no-ops) at the -** beginning and end of zAff are ignored. If all entries in zAff are -** SQLITE_AFF_BLOB, then no code gets generated. +** As an optimization, SQLITE_AFF_BLOB and SQLITE_AFF_NONE entries (which +** are no-ops) at the beginning and end of zAff are ignored. If all entries +** in zAff are SQLITE_AFF_BLOB or SQLITE_AFF_NONE, then no code gets generated. ** ** This routine makes its own copy of zAff so that the caller is free ** to modify zAff after this routine returns. @@ -333,15 +333,16 @@ static void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){ } assert( v!=0 ); - /* Adjust base and n to skip over SQLITE_AFF_BLOB entries at the beginning - ** and end of the affinity string. + /* Adjust base and n to skip over SQLITE_AFF_BLOB and SQLITE_AFF_NONE + ** entries at the beginning and end of the affinity string. */ - while( n>0 && zAff[0]==SQLITE_AFF_BLOB ){ + assert( SQLITE_AFF_NONE<SQLITE_AFF_BLOB ); + while( n>0 && zAff[0]<=SQLITE_AFF_BLOB ){ n--; base++; zAff++; } - while( n>1 && zAff[n-1]==SQLITE_AFF_BLOB ){ + while( n>1 && zAff[n-1]<=SQLITE_AFF_BLOB ){ n--; } |