mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Experimental implementation of NULLS FIRST/LAST. This branch still has problems - the most significant of which is that ORDER BY clauses with a non-default NULLS FIRST/LAST qualifier can never use an index.
FossilOrigin-Name: 07babb0f897fc8c9cb5b30481899c32fdd743f3f3ca508d8d957826252107dd5
This commit is contained in:
@@ -2227,9 +2227,14 @@ case OP_Compare: {
|
||||
REGISTER_TRACE(p2+idx, &aMem[p2+idx]);
|
||||
assert( i<pKeyInfo->nKeyField );
|
||||
pColl = pKeyInfo->aColl[i];
|
||||
bRev = pKeyInfo->aSortOrder[i];
|
||||
bRev = (pKeyInfo->aSortFlags[i] & KEYINFO_ORDER_DESC);
|
||||
iCompare = sqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl);
|
||||
if( iCompare ){
|
||||
if( (pKeyInfo->aSortFlags[i] & KEYINFO_ORDER_BIGNULL)
|
||||
&& ((aMem[p1+idx].flags & MEM_Null) || (aMem[p2+idx].flags & MEM_Null))
|
||||
){
|
||||
iCompare = -iCompare;
|
||||
}
|
||||
if( bRev ) iCompare = -iCompare;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user