1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Prevent NULLS FIRST/LAST from being used in CREATE INDEX and other statements.

FossilOrigin-Name: bb9767a287097a615aeb4abdba689b10e1a1c36c016c8e55905b508075e62c86
This commit is contained in:
dan
2019-08-19 17:26:32 +00:00
parent 8328369740
commit 9105fd5189
8 changed files with 96 additions and 17 deletions

View File

@@ -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;
}
}
}