MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / PAR_sort_internal

Function PAR_sort_internal

src/jrd/par.cpp:1519–1564  ·  view source on GitHub ↗

Parse the internals of a sort clause. This is used for blr_sort, blr_project, blr_group_by and blr_partition_by.

Source from the content-addressed store, hash-verified

1517// Parse the internals of a sort clause. This is used for blr_sort, blr_project, blr_group_by
1518// and blr_partition_by.
1519SortNode* PAR_sort_internal(thread_db* tdbb, CompilerScratch* csb, bool allClauses, USHORT count)
1520{
1521 SET_TDBB(tdbb);
1522
1523 SortNode* sort = FB_NEW_POOL(*tdbb->getDefaultPool()) SortNode(
1524 *tdbb->getDefaultPool());
1525
1526 NestConst<ValueExprNode>* ptr = sort->expressions.getBuffer(count);
1527 SortDirection* ptr2 = sort->direction.getBuffer(count);
1528 NullsPlacement* ptr3 = sort->nullOrder.getBuffer(count);
1529
1530 while (count-- > 0)
1531 {
1532 if (allClauses)
1533 {
1534 UCHAR code = csb->csb_blr_reader.getByte();
1535
1536 switch (code)
1537 {
1538 case blr_nullsfirst:
1539 *ptr3++ = NULLS_FIRST;
1540 code = csb->csb_blr_reader.getByte();
1541 break;
1542
1543 case blr_nullslast:
1544 *ptr3++ = NULLS_LAST;
1545 code = csb->csb_blr_reader.getByte();
1546 break;
1547
1548 default:
1549 *ptr3++ = NULLS_DEFAULT;
1550 }
1551
1552 *ptr2++ = (code == blr_descending) ? ORDER_DESC : ORDER_ASC;
1553 }
1554 else
1555 {
1556 *ptr2++ = ORDER_ANY;
1557 *ptr3++ = NULLS_DEFAULT;
1558 }
1559
1560 *ptr++ = PAR_parse_value(tdbb, csb);
1561 }
1562
1563 return sort;
1564}
1565
1566
1567// Parse a boolean node.

Callers 3

parseWindowMethod · 0.85
PAR_sortFunction · 0.85

Calls 6

SET_TDBBFunction · 0.85
PAR_parse_valueFunction · 0.85
SortNodeClass · 0.70
getDefaultPoolMethod · 0.45
getBufferMethod · 0.45
getByteMethod · 0.45

Tested by

no test coverage detected