1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibSQL: Invent statement execution machinery and CREATE SCHEMA statement

This patch introduces the ability execute parsed SQL statements. The
abstract AST Statement node now has a virtual 'execute' method. This
method takes a Database object as parameter and returns a SQLResult
object.

Also introduced here is the CREATE SCHEMA statement. Tables live in a
schema, and if no schema is present in a table reference the 'default'
schema is implied. This schema is created if it doesn't yet exist when
a Database object is created.

Finally, as a proof of concept, the CREATE SCHEMA and CREATE TABLE
statements received an 'execute' implementation. The CREATE TABLE
method is not able to create tables created from SQL queries yet.
This commit is contained in:
Jan de Visser 2021-06-27 21:32:22 -04:00 committed by Ali Mohammad Pur
parent 30691549fd
commit 1037d6b0eb
9 changed files with 147 additions and 33 deletions

View file

@ -15,20 +15,15 @@
namespace SQL {
/**
* A Key is an element of a random-access data structure persisted in a Heap.
* Key objects stored in such a structure have a definition controlling the
* number of parts or columns the key has, the types of the parts, and the
* sort order of these parts. Besides having an optional definition, a Key
* consists of one Value object per part. In addition, keys have a u32 pointer
* A Tuple is an element of a random-access data structure persisted in a Heap.
* Tuple objects stored in such a structure have a definition controlling the
* number of parts or columns the tuple has, the types of the parts, and the
* sort order of these parts. Besides having an optional definition, a Tuple
* consists of one Value object per part. In addition, tuples have a u32 pointer
* member which points to a Heap location.
*
* Key objects without a definition can be used to locate/find objects in
* a searchable data collection.
*
* FIXME Currently the Key definition is passed as an `IndexDefinition` meta
* data object, meaning that names are associated with both the definition
* and the parts of the key. These names are not used, meaning that key
* definitions should probably be constructed in a different way.
* Tuple is a base class; concrete subclasses are Key, which implements the
* elements of an index, and Row, which implements the rows in a table.
*/
class Tuple {
public: