ladybird/Userland/Libraries/LibSQL/Forward.h
Timothy Flynn 2397836f8e LibSQL+SQLServer: Introduce and use ResultOr<ValueType>
The result of a SQL statement execution is either:
    1. An error.
    2. The list of rows inserted, deleted, selected, etc.

(2) is currently represented by a combination of the Result class and
the ResultSet list it holds. This worked okay, but issues start to
arise when trying to use Result in non-statement contexts (for example,
when introducing Result to SQL expression execution).

What we really need is for Result to be a thin wrapper that represents
both (1) and (2), and to not have any explicit members like a ResultSet.
So this commit removes ResultSet from Result, and introduces ResultOr,
which is just an alias for AK::ErrorOrr. Statement execution now returns
ResultOr<ResultSet> instead of Result. This further opens the door for
expression execution to return ResultOr<Value> in the future.

Lastly, this moves some other context held by Result over to ResultSet.
This includes the row count (which is really just the size of ResultSet)
and the command for which the result is for.
2022-02-10 23:11:13 +01:00

94 lines
1.8 KiB
C++

/*
* Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
namespace SQL {
class BTree;
class BTreeIterator;
class ColumnDef;
class Database;
class HashBucket;
class HashDirectoryNode;
class HashIndex;
class HashIndexIterator;
class Heap;
class Index;
class IndexNode;
class IndexDef;
class Key;
class KeyPartDef;
class Relation;
class Result;
class ResultSet;
class Row;
class SchemaDef;
class Serializer;
class TableDef;
class TreeNode;
class Tuple;
class TupleDescriptor;
struct TupleElementDescriptor;
class Value;
}
namespace SQL::AST {
class AddColumn;
class AlterTable;
class ASTNode;
class BetweenExpression;
class BinaryOperatorExpression;
class BlobLiteral;
class CaseExpression;
class CastExpression;
class ChainedExpression;
class CollateExpression;
class ColumnDefinition;
class ColumnNameExpression;
class CommonTableExpression;
class CommonTableExpressionList;
class CreateTable;
class Delete;
class DropColumn;
class DropTable;
class ErrorExpression;
class ErrorStatement;
class ExistsExpression;
class Expression;
class GroupByClause;
class InChainedExpression;
class InSelectionExpression;
class Insert;
class InTableExpression;
class InvertibleNestedDoubleExpression;
class InvertibleNestedExpression;
class IsExpression;
class Lexer;
class LimitClause;
class MatchExpression;
class NestedDoubleExpression;
class NestedExpression;
class NullExpression;
class NullLiteral;
class NumericLiteral;
class OrderingTerm;
class Parser;
class QualifiedTableName;
class RenameColumn;
class RenameTable;
class ResultColumn;
class ReturningClause;
class Select;
class SignedNumber;
class Statement;
class StringLiteral;
class TableOrSubquery;
class Token;
class TypeName;
class UnaryOperatorExpression;
class Update;
}