Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/dsql/BoolNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,33 @@ BoolExprNode* ComparativeBoolNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
literalArg = value;
};

convertLiteralToOperand(procArg1, procArg2);
convertLiteralToOperand(procArg2, procArg1);
// Pattern matching operators (LIKE, CONTAINING, etc) compare strings, so their literals are kept as is
switch (blrOp)
{
case blr_eql:
case blr_neq:
case blr_gtr:
case blr_geq:
case blr_lss:
case blr_leq:
case blr_equiv:
case blr_between:
convertLiteralToOperand(procArg1, procArg2);
convertLiteralToOperand(procArg2, procArg1);

if (blrOp == blr_between)
convertLiteralToOperand(procArg3, procArg1);
if (blrOp == blr_between)
convertLiteralToOperand(procArg3, procArg1);
break;

case blr_containing:
case blr_like:
case blr_similar:
case blr_starting:
break;

default:
fb_assert(false);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add all the pattern matching BLRs to the switch (with just break;) and the default section with fb_assert(false). This would trigger an explicit decision how any newly added BLR comparison op-code should be preprocessed in this routine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: the pattern matching ops are now listed with just break, and default has fb_assert(false).


ComparativeBoolNode* node = FB_NEW_POOL(dsqlScratch->getPool()) ComparativeBoolNode(dsqlScratch->getPool(), blrOp,
procArg1,
Expand Down