diff options
author | dan <dan@noemail.net> | 2019-08-19 17:26:32 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2019-08-19 17:26:32 +0000 |
commit | 9105fd51893062a8503c8850e5d88ad49de28495 (patch) | |
tree | 9fcb6ba7b6de2693d8817148de1f893e4dcc9d65 /src/expr.c | |
parent | 8328369740b33c1de8ed362fc70e76d07f1e1159 (diff) | |
download | sqlite-9105fd51893062a8503c8850e5d88ad49de28495.tar.gz sqlite-9105fd51893062a8503c8850e5d88ad49de28495.zip |
Prevent NULLS FIRST/LAST from being used in CREATE INDEX and other statements.
FossilOrigin-Name: bb9767a287097a615aeb4abdba689b10e1a1c36c016c8e55905b508075e62c86
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/expr.c b/src/expr.c index c5072aa61..6948c5a0f 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1653,6 +1653,7 @@ vector_append_error: ** Set the sort order for the last element on the given ExprList. */ void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder, int eNulls){ + struct ExprList_item *pItem; if( p==0 ) return; assert( p->nExpr>0 ); @@ -1666,10 +1667,18 @@ void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder, int eNulls){ || eNulls==SQLITE_SO_DESC ); - if( iSortOrder==SQLITE_SO_UNDEFINED ) iSortOrder = SQLITE_SO_ASC; - p->a[p->nExpr-1].sortFlags = (u8)iSortOrder; - if( eNulls!=SQLITE_SO_UNDEFINED && iSortOrder!=eNulls ){ - p->a[p->nExpr-1].sortFlags |= KEYINFO_ORDER_BIGNULL; + pItem = &p->a[p->nExpr-1]; + assert( pItem->bNulls==0 ); + if( iSortOrder==SQLITE_SO_UNDEFINED ){ + iSortOrder = SQLITE_SO_ASC; + } + pItem->sortFlags = (u8)iSortOrder; + + if( eNulls!=SQLITE_SO_UNDEFINED ){ + pItem->bNulls = 1; + if( iSortOrder!=eNulls ){ + pItem->sortFlags |= KEYINFO_ORDER_BIGNULL; + } } } |