1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Pass subtype information through the aggregate ORDER BY sorter for

aggregate functions that use subtype information.

FossilOrigin-Name: 3536f4030eab6d650b7ed729d2f71eb6cc3b5fbe16b4e96b99008d66522aaccb
This commit is contained in:
drh
2023-12-14 13:58:50 +00:00
parent 3e4195c60d
commit 07117f8118
7 changed files with 123 additions and 15 deletions

View File

@@ -8674,6 +8674,42 @@ case OP_ClrSubtype: { /* in1 */
break;
}
/* Opcode: GetSubtype P1 P2 * * *
** Synopsis: r[P2] = r[P1].subtype
**
** Extract the subtype value from register P1 and write that subtype
** into register P2. If P1 has no subtype, then P1 gets a NULL.
*/
case OP_GetSubtype: { /* in1 out2 */
pIn1 = &aMem[pOp->p1];
pOut = &aMem[pOp->p2];
if( pIn1->flags & MEM_Subtype ){
sqlite3VdbeMemSetInt64(pOut, pIn1->eSubtype);
}else{
sqlite3VdbeMemSetNull(pOut);
}
break;
}
/* Opcode: SetSubtype P1 P2 * * *
** Synopsis: r[P2].subtype = r[P1]
**
** Set the subtype value of register P2 to the integer from register P1.
** If P1 is NULL, clear the subtype from p2.
*/
case OP_SetSubtype: { /* in1 out2 */
pIn1 = &aMem[pOp->p1];
pOut = &aMem[pOp->p2];
if( pIn1->flags & MEM_Null ){
pOut->flags &= ~MEM_Subtype;
}else{
assert( pIn1->flags & MEM_Int );
pOut->flags |= MEM_Subtype;
pOut->eSubtype = (u8)(pIn1->u.i & 0xff);
}
break;
}
/* Opcode: FilterAdd P1 * P3 P4 *
** Synopsis: filter(P1) += key(P3@P4)
**