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

Function GEN_statement

src/dsql/gen.cpp:228–282  ·  view source on GitHub ↗

Generate complete blr for a dsqlScratch.

Source from the content-addressed store, hash-verified

226
227// Generate complete blr for a dsqlScratch.
228void GEN_statement(DsqlCompilerScratch* scratch, DmlNode* node)
229{
230 DsqlStatement* statement = scratch->getDsqlStatement();
231
232 if (statement->getBlrVersion() == 4)
233 scratch->appendUChar(blr_version4);
234 else
235 scratch->appendUChar(blr_version5);
236
237 const bool block = statement->getType() == DsqlStatement::TYPE_EXEC_BLOCK ||
238 statement->getType() == DsqlStatement::TYPE_SELECT_BLOCK;
239
240 // To parse sub-routines messages, they must not have that begin...end pair.
241 // And since it appears to be unnecessary for execute block too, do not generate them.
242 if (!block)
243 scratch->appendUChar(blr_begin);
244
245 scratch->putOuterMaps();
246 GEN_hidden_variables(scratch);
247
248 switch (statement->getType())
249 {
250 case DsqlStatement::TYPE_SELECT:
251 case DsqlStatement::TYPE_SELECT_UPD:
252 case DsqlStatement::TYPE_EXEC_BLOCK:
253 case DsqlStatement::TYPE_SELECT_BLOCK:
254 node->genBlr(scratch);
255 break;
256
257 ///case DsqlStatement::TYPE_RETURNING_CURSOR:
258 default:
259 {
260 dsql_msg* message = statement->getSendMsg();
261 if (!message->msg_parameter)
262 statement->setSendMsg(NULL);
263 else
264 {
265 GEN_port(scratch, message);
266 scratch->appendUChar(blr_receive_batch);
267 scratch->appendUChar(message->msg_number);
268 }
269 message = statement->getReceiveMsg();
270 if (!message->msg_parameter)
271 statement->setReceiveMsg(NULL);
272 else
273 GEN_port(scratch, message);
274 node->genBlr(scratch);
275 }
276 }
277
278 if (!block)
279 scratch->appendUChar(blr_end);
280
281 scratch->appendUChar(blr_eoc);
282}
283
284
285/**

Callers 2

dsqlPassMethod · 0.85
genBlrMethod · 0.85

Calls 12

GEN_hidden_variablesFunction · 0.85
GEN_portFunction · 0.85
getBlrVersionMethod · 0.80
appendUCharMethod · 0.80
putOuterMapsMethod · 0.80
getSendMsgMethod · 0.80
setSendMsgMethod · 0.80
getReceiveMsgMethod · 0.80
setReceiveMsgMethod · 0.80
getDsqlStatementMethod · 0.45
getTypeMethod · 0.45
genBlrMethod · 0.45

Tested by

no test coverage detected