mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibSQL: Parse EXISTS expressions
The EXISTS expression is a bit of an odd-man-out because it can appear as any of the following forms: EXISTS (select-stmt) NOT EXISTS (select-stmt) (select-stmt) Which makes it the only keyword expression that doesn't require its keyword to actually be used. The consequence is that we might come across an EXISTS expression while parsing another expression type; NOT would have triggered a unary operator expression, and an opening parentheses would have triggered an expression chain.
This commit is contained in:
parent
e62e76ca1a
commit
99b38aa3fa
4 changed files with 80 additions and 5 deletions
|
@ -537,6 +537,22 @@ private:
|
|||
RefPtr<Expression> m_else_expression;
|
||||
};
|
||||
|
||||
class ExistsExpression : public Expression {
|
||||
public:
|
||||
ExistsExpression(NonnullRefPtr<Select> select_statement, bool invert_expression)
|
||||
: m_select_statement(move(select_statement))
|
||||
, m_invert_expression(invert_expression)
|
||||
{
|
||||
}
|
||||
|
||||
const NonnullRefPtr<Select>& select_statement() const { return m_select_statement; }
|
||||
bool invert_expression() const { return m_invert_expression; }
|
||||
|
||||
private:
|
||||
NonnullRefPtr<Select> m_select_statement;
|
||||
bool m_invert_expression;
|
||||
};
|
||||
|
||||
class CollateExpression : public NestedExpression {
|
||||
public:
|
||||
CollateExpression(NonnullRefPtr<Expression> expression, String collation_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue