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

Function GEN_sort

src/dsql/gen.cpp:619–646  ·  view source on GitHub ↗

Generate a sort clause.

Source from the content-addressed store, hash-verified

617
618// Generate a sort clause.
619void GEN_sort(DsqlCompilerScratch* dsqlScratch, UCHAR blrVerb, ValueListNode* list)
620{
621 dsqlScratch->appendUChar(blrVerb);
622 dsqlScratch->appendUChar(list ? list->items.getCount() : 0);
623
624 if (list)
625 {
626 NestConst<ValueExprNode>* ptr = list->items.begin();
627
628 for (const NestConst<ValueExprNode>* const end = list->items.end(); ptr != end; ++ptr)
629 {
630 OrderNode* orderNode = nodeAs<OrderNode>(*ptr);
631
632 switch (orderNode->nullsPlacement)
633 {
634 case OrderNode::NULLS_FIRST:
635 dsqlScratch->appendUChar(blr_nullsfirst);
636 break;
637 case OrderNode::NULLS_LAST:
638 dsqlScratch->appendUChar(blr_nullslast);
639 break;
640 }
641
642 dsqlScratch->appendUChar((orderNode->descending ? blr_descending : blr_ascending));
643 GEN_expr(dsqlScratch, orderNode->value);
644 }
645 }
646}
647
648
649// Write a context number into the BLR buffer. Check for possible overflow.

Callers 2

GEN_rseFunction · 0.85
genBlrMethod · 0.85

Calls 5

GEN_exprFunction · 0.85
appendUCharMethod · 0.80
getCountMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected