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

Function dsqlPassHiddenVariable

src/dsql/StmtNodes.cpp:10269–10299  ·  view source on GitHub ↗

Create (if necessary) a hidden variable to store a temporary value.

Source from the content-addressed store, hash-verified

10267
10268// Create (if necessary) a hidden variable to store a temporary value.
10269static VariableNode* dsqlPassHiddenVariable(DsqlCompilerScratch* dsqlScratch, ValueExprNode* expr)
10270{
10271 thread_db* tdbb = JRD_get_thread_data();
10272
10273 // For some node types, it's better to not create temporary value.
10274 switch (expr->getType())
10275 {
10276 case ExprNode::TYPE_CURRENT_DATE:
10277 case ExprNode::TYPE_CURRENT_TIME:
10278 case ExprNode::TYPE_CURRENT_TIMESTAMP:
10279 case ExprNode::TYPE_CURRENT_ROLE:
10280 case ExprNode::TYPE_CURRENT_USER:
10281 case ExprNode::TYPE_FIELD:
10282 case ExprNode::TYPE_INTERNAL_INFO:
10283 case ExprNode::TYPE_LITERAL:
10284 case ExprNode::TYPE_NULL:
10285 case ExprNode::TYPE_PARAMETER:
10286 case ExprNode::TYPE_RECORD_KEY:
10287 case ExprNode::TYPE_VARIABLE:
10288 return NULL;
10289 }
10290
10291 VariableNode* varNode = FB_NEW_POOL(*tdbb->getDefaultPool()) VariableNode(*tdbb->getDefaultPool());
10292 varNode->dsqlVar = dsqlScratch->makeVariable(NULL, "", dsql_var::TYPE_HIDDEN,
10293 0, 0, dsqlScratch->hiddenVarsNumber++);
10294
10295 DsqlDescMaker::fromNode(dsqlScratch, &varNode->dsqlVar->desc, expr);
10296 varNode->setDsqlDesc(varNode->dsqlVar->desc);
10297
10298 return varNode;
10299}
10300
10301// Process loop interruption.
10302static USHORT dsqlPassLabel(DsqlCompilerScratch* dsqlScratch, bool breakContinue, MetaName* label)

Callers 1

dsqlPassMethod · 0.85

Calls 6

JRD_get_thread_dataFunction · 0.85
makeVariableMethod · 0.80
VariableNodeClass · 0.70
getTypeMethod · 0.45
getDefaultPoolMethod · 0.45
setDsqlDescMethod · 0.45

Tested by

no test coverage detected