classPredicateRule
final class PredicateRule
Lowers the predicate level: IN, BETWEEN, LIKE, REGEXP, SOUNDS LIKE and MEMBER OF.
Rule: MYSQL-PREDICATE-001. Scope: predicate, opt_escape (5.6, 5.7), opt_of (8.0 and later). Every form takes a bit_expr operand; NOT before the keyword is the negated form; IN (expr) keeps its single element; the optional OF of MEMBER OF is not part of the structure; RLIKE is the keyword REGEXP. Constructs: InList, InQuery, Between, Like, Regexp, SoundsLike, MemberOf. Terminates: every child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/comparison-operators.html, https://dev.mysql.com/doc/refman/8.4/en/string-comparison-functions.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a node of predicate.
Parameters
$predicate | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 2
Called from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::boolean() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:153
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::apply() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:173
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::apply() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:174
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\PredicateRule::operation() packages/sql-semantics-mysql/src/Lowering/Expression/PredicateRule.php:92
Calls 5
- method-call Lowering::form() line 63
- new BitRule line 64
- method-call BitRule::bitExpression() line 66
- class-const PredicateRule::NEGATED() line 69
- method-call PredicateRule::operation() line 74
Lowers the operation of a predicate production over its lowered operand; offset is one when NOT is written.
Returns
Throws
ImplementationGap When a production has no ruleTest cases 2
Called from 1
Calls 12
- function-call
str_replaceline 87 - new InQuery line 88
- method-call Form::node() line 88
- new InList line 90
- new Between line 92
- method-call PredicateRule::predicate() line 92
- new Like line 93
- method-call PredicateRule::escape() line 93
- new Regexp line 96
- new SoundsLike line 97
- method-call PredicateRule::member() line 98
- static-call ImplementationGap::production() line 99
Lowers MEMBER OF, confirming the optional OF.
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 6
- method-call Lowering::form() line 110
- method-call Form::node() line 110
- static-call ImplementationGap::production() line 112
- new MemberOf line 115
- class-const OptionalWords::Written() line 115
- class-const OptionalWords::Omitted() line 115
Lowers the optional ESCAPE clause of MySQL 5.6 and 5.7.
Parameters
$escape | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- method-call Lowering::form() line 125
- static-call ImplementationGap::production() line 130
Private surface 2§
Implementation details, listed for orientation only.
private const NEGATED = ['predicate: bit_expr not IN_SYM ( subselect )' => 1, 'predicate: bit_expr not …private Lowering $loweringTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
PredicateRuleTest::testEscapeLowersTheEscapeClauseOfMySql5callsPredicateRuleTest::testMemberLowersMemberWithoutOfcallsPredicateRuleTest::testOperationLowersSoundsLikecallsPredicateRuleTest::testOperationLowersTheListAndSubqueryFormsOfIncallsPredicateRuleTest::testPredicateLowersANegatedRangeWithARangeInTheUpperBoundcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::boolean() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:153
- new SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::apply() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:168
Method calls 3
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::boolean() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:153
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::apply() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:173
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\ConditionRule::apply() packages/sql-semantics-mysql/src/Lowering/Expression/ConditionRule.php:174