1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

LibSQL: Convert binary SQL operations to be fallible

Now that expression evaluation can use TRY, we can allow binary operator
methods to fail as well. This also fixes a few instances of converting a
Value to a double when we meant to convert to an integer.
This commit is contained in:
Timothy Flynn 2022-02-11 10:23:20 -05:00 committed by Linus Groh
parent b15db851fe
commit bfe1bd9726
3 changed files with 168 additions and 59 deletions

View file

@ -12,6 +12,7 @@
#include <AK/String.h>
#include <AK/Variant.h>
#include <LibSQL/Forward.h>
#include <LibSQL/Result.h>
#include <LibSQL/TupleDescriptor.h>
#include <LibSQL/Type.h>
#include <LibSQL/ValueImpl.h>
@ -118,15 +119,15 @@ public:
bool operator>(Value const&) const;
bool operator>=(Value const&) const;
Value add(Value const&) const;
Value subtract(Value const&) const;
Value multiply(Value const&) const;
Value divide(Value const&) const;
Value modulo(Value const&) const;
Value shift_left(Value const&) const;
Value shift_right(Value const&) const;
Value bitwise_or(Value const&) const;
Value bitwise_and(Value const&) const;
ResultOr<Value> add(Value const&) const;
ResultOr<Value> subtract(Value const&) const;
ResultOr<Value> multiply(Value const&) const;
ResultOr<Value> divide(Value const&) const;
ResultOr<Value> modulo(Value const&) const;
ResultOr<Value> shift_left(Value const&) const;
ResultOr<Value> shift_right(Value const&) const;
ResultOr<Value> bitwise_or(Value const&) const;
ResultOr<Value> bitwise_and(Value const&) const;
[[nodiscard]] TupleElementDescriptor descriptor() const
{