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

Method pass1

src/dsql/BoolNodes.cpp:557–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555}
556
557BoolExprNode* ComparativeBoolNode::pass1(thread_db* tdbb, CompilerScratch* csb)
558{
559 bool invariantCheck = false;
560
561 switch (blrOp)
562 {
563 case blr_like:
564 case blr_similar:
565 case blr_containing:
566 case blr_starting:
567 invariantCheck = true;
568 break;
569 }
570
571 doPass1(tdbb, csb, arg1.getAddress());
572
573 if (invariantCheck)
574 {
575 // We need to take care of invariantness expressions to be able to pre-compile the pattern.
576 nodFlags |= FLAG_INVARIANT;
577 csb->csb_current_nodes.push(this);
578 }
579
580 doPass1(tdbb, csb, arg2.getAddress());
581 doPass1(tdbb, csb, arg3.getAddress());
582
583 if (invariantCheck)
584 {
585 csb->csb_current_nodes.pop();
586
587 // If there is no top-level RSE present and patterns are not constant, unmark node as invariant
588 // because it may be dependent on data or variables.
589 if ((nodFlags & FLAG_INVARIANT) &&
590 (!nodeIs<LiteralNode>(arg2) || (arg3 && !nodeIs<LiteralNode>(arg3))))
591 {
592 for (const auto& ctxNode : csb->csb_current_nodes)
593 {
594 if (nodeIs<RseNode>(ctxNode))
595 return this;
596 }
597
598 nodFlags &= ~FLAG_INVARIANT;
599 }
600 }
601
602 return this;
603}
604
605void ComparativeBoolNode::pass2Boolean(thread_db* tdbb, CompilerScratch* csb, std::function<void ()> process)
606{

Callers

nothing calls this directly

Calls 4

pass1Function · 0.85
getAddressMethod · 0.80
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected