| 9874 | } |
| 9875 | |
| 9876 | static 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. |
| 9923 | static void dsqlGenReturningLocalTableCursor(DsqlCompilerScratch* dsqlScratch, ReturningClause* returning, |
no test coverage detected