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

Function dsqlGenReturning

src/dsql/StmtNodes.cpp:9876–9920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9874}
9875
9876static void dsqlGenReturning(DsqlCompilerScratch* dsqlScratch, ReturningClause* returning,
9877 Nullable<USHORT> localTableNumber)
9878{
9879 if (localTableNumber.isAssigned())
9880 {
9881 const USHORT localStoreContext = dsqlScratch->contextNumber++;
9882
9883 dsqlScratch->appendUChar(blr_store);
9884 dsqlScratch->putBlrMarkers(StmtNode::MARK_AVOID_COUNTERS);
9885 dsqlScratch->appendUChar(blr_local_table_id);
9886 dsqlScratch->appendUShort(localTableNumber.value);
9887 dsqlScratch->appendMetaString(""); // alias
9888 GEN_stuff_context_number(dsqlScratch, localStoreContext);
9889
9890 dsqlScratch->appendUChar(blr_begin);
9891
9892 USHORT fieldNum = 0;
9893
9894 for (auto& retSource : returning->first->items)
9895 {
9896 dsqlScratch->appendUChar(blr_assignment);
9897 retSource->genBlr(dsqlScratch);
9898 dsqlScratch->appendUChar(blr_fid);
9899 GEN_stuff_context_number(dsqlScratch, localStoreContext);
9900 dsqlScratch->appendUShort(fieldNum++);
9901 }
9902
9903 dsqlScratch->appendUChar(blr_end);
9904 }
9905 else
9906 {
9907 dsqlScratch->appendUChar(blr_begin);
9908
9909 auto retTargetIt = returning->second->items.begin();
9910
9911 for (auto& retSource : returning->first->items)
9912 {
9913 dsqlScratch->appendUChar(blr_assignment);
9914 retSource->genBlr(dsqlScratch);
9915 (*retTargetIt++)->genBlr(dsqlScratch);
9916 }
9917
9918 dsqlScratch->appendUChar(blr_end);
9919 }
9920}
9921
9922// Generate BLR for returning's local table cursor.
9923static void dsqlGenReturningLocalTableCursor(DsqlCompilerScratch* dsqlScratch, ReturningClause* returning,

Callers 1

genBlrMethod · 0.85

Calls 8

GEN_stuff_context_numberFunction · 0.85
isAssignedMethod · 0.80
appendUCharMethod · 0.80
putBlrMarkersMethod · 0.80
appendUShortMethod · 0.80
appendMetaStringMethod · 0.80
genBlrMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected