mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Add support for "ORDER BY ... NULLS FIRST" and "ORDER BY ... NULLS LAST". Use this to fix ticket [f8a7060e].
FossilOrigin-Name: 94085fb3e756bc984237b74b6e29c68462ad860870c64dcb5124feaeec387660
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