mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
LibSQL: Add parsing and evaluation of BOOLEAN type literals
This allows you to enter TRUE or FALSE in a SQL statement for BOOLEAN types. Note that this differs from SQLite, which requires entering 1 or 0 for BOOLEANs; having explicit keywords feels a bit more natural.
This commit is contained in:
parent
c67c7dd1f2
commit
41e0e4cdd7
5 changed files with 43 additions and 0 deletions
|
@ -357,6 +357,21 @@ private:
|
|||
DeprecatedString m_value;
|
||||
};
|
||||
|
||||
class BooleanLiteral : public Expression {
|
||||
public:
|
||||
explicit BooleanLiteral(bool value)
|
||||
: m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
bool value() const { return m_value; }
|
||||
|
||||
virtual ResultOr<Value> evaluate(ExecutionContext&) const override;
|
||||
|
||||
private:
|
||||
bool m_value { false };
|
||||
};
|
||||
|
||||
class NullLiteral : public Expression {
|
||||
public:
|
||||
virtual ResultOr<Value> evaluate(ExecutionContext&) const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue