summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSQL/Forward.h
AgeCommit message (Collapse)Author
2022-02-10LibSQL+SQLServer: Introduce and use ResultOr<ValueType>Timothy Flynn
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-10LibSQL: Remove now-unused SQLResult classTimothy Flynn
2022-02-10LibSQL: Add a new Result class to replace SQLResultTimothy Flynn
The existing SQLResult class predates our TRY semantics. As a result, in the AST execution methods, there is a lot of is_error checking on values that could instead be wrapped with TRY. This new class will allow such semantics, and is also stack allocated (no need to be a RefPtr). It is heavily based on LibJS's completion class.
2022-01-31Everywhere: Update copyrights with my new serenityos.org e-mail :^)Timothy Flynn
2021-08-21LibSQL: Introduce Serializer as a mediator between Heap and client codeJan de Visser
Classes reading and writing to the data heap would communicate directly with the Heap object, and transfer ByteBuffers back and forth with it. This makes things like caching and locking hard. Therefore all data persistence activity will be funneled through a Serializer object which in turn submits it to the Heap. Introducing this unfortunately resulted in a huge amount of churn, in which a number of smaller refactorings got caught up as well.
2021-07-08LibSQL: Move Order and Nulls enums from SQL::AST to SQL namespaceJan de Visser
The Order enum is used in the Meta component of LibSQL. Using this enum meant having to include the monster AST/AST.h include file. Furthermore, they are sort of basic and therefore can live in the general SQL namespace. Moved to LibSQL/Type.h. Also introduced a new class, SQLResult, which is needed in future patches.
2021-06-24LibSQL: Move Lexer and Parser machinery to AST directoryJan de Visser
The SQL engine is expected to be a fairly sizeable piece of software. Therefore we're starting to restructure the codebase for growth.
2021-06-19LibSQL: Database layerJan de Visser
This patch implements the beginnings of a database API allowing for the creation of tables, inserting rows in those tables, and retrieving those rows.
2021-06-19LibSQL: Hash index implementation for the SQL storage layerJan de Visser
This patch implements a basic hash index. It uses the extendible hashing algorith. Also includes a test file.
2021-06-19LibSQL: BTree index, Heap, and Meta objects for SQL Storage layerJan de Visser
Unfortunately this patch is quite large. The main functionality included are a BTree index implementation and the Heap class which manages persistent storage. Also included are a Key subclass of the Tuple class, which is a specialization for index key tuples. This "dragged in" the Meta layer, which has classes defining SQL objects like tables and indexes.
2021-06-19LibSQL: Basic dynamic value classes for SQL Storage layerJan de Visser
This patch adds the basic dynamic value classes used by the SQL Storage layer. The most elementary class is Value, which holds a typed Value which can be converted to standard C++ types. A Tuple is a collection of Values described by a TupleDescriptor, which specifies the names, types, and ordering of the elements in the Tuple. Tuples and Values can be serialized and deserialized to and from ByteBuffers. This is mechanism which is used to save them to disk. Tuples are used as keys in SQL indexes and rows in SQL tables. Also included is a test file.
2021-04-24LibSQL: Parse ALTER TABLE statementTimothy Flynn
There are 4 forms an ALTER TABLE statement can take, and each are very distinct, so they each get their own AST node class.
2021-04-24LibSQL: Parse UPDATE statementTimothy Flynn
This also migrates parsing of conflict resolution to a helper method, since both INSERT and UPDATE need it.
2021-04-24LibSQL: Parse INSERT statementTimothy Flynn
This also adds missing '&' on a couple AST getter methods.
2021-04-24LibSQL: Add missing forward declarationsTimothy Flynn
2021-04-22LibSQL: Parse (most of) SELECT statementTimothy Flynn
This doesn't yet parse join clauses, windowing functions, or compound SELECT statements.
2021-04-22LibSQL: Fix parsing of lists of common-table-expressionTimothy Flynn
Misread the graph: In the "WITH [RECURSIVE] common-table-expression" section, common-table-expression is actually a repeating list. This changes the parser to correctly parse this section as a list. Create a new AST node, CommonTableExpressionList, to store both this list and the boolean RECURSIVE attribute (because every statement that uses this list also includes the RECURSIVE attribute beforehand).
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-21LibSQL: Parse DELETE statementTimothy Flynn
2021-04-21LibSQL: Parse most language expressionsTimothy Flynn
https://sqlite.org/lang_expr.html The entry point to using expressions, parse_expression(), is not used by SQL::Parser in this commit. But there's so much here that it's easier to grok as its own commit.
2021-04-21LibSQL: Add forwarding headerTimothy Flynn
SQL AST nodes will need to have other node types forward declared before using them.