summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSQL/Meta.cpp
diff options
context:
space:
mode:
authorJan de Visser <jan@de-visser.net>2021-06-27 21:00:08 -0400
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-08 17:55:59 +0430
commit30691549fdc0d6f703735fb0c30ab54cf0cecb65 (patch)
treeefb328f7a7b42e5d647cbe8085d94920c57d6932 /Userland/Libraries/LibSQL/Meta.cpp
parent633dc74606a556cdea4606f93fa50f01f46e2cd6 (diff)
downloadserenity-30691549fdc0d6f703735fb0c30ab54cf0cecb65.zip
LibSQL: Move Order and Nulls enums from SQL::AST to SQL namespace
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.
Diffstat (limited to 'Userland/Libraries/LibSQL/Meta.cpp')
-rw-r--r--Userland/Libraries/LibSQL/Meta.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Userland/Libraries/LibSQL/Meta.cpp b/Userland/Libraries/LibSQL/Meta.cpp
index ce8dc12bd2..43a240f9af 100644
--- a/Userland/Libraries/LibSQL/Meta.cpp
+++ b/Userland/Libraries/LibSQL/Meta.cpp
@@ -37,7 +37,7 @@ NonnullRefPtr<IndexDef> SchemaDef::index_def()
{
NonnullRefPtr<IndexDef> s_index_def = IndexDef::construct("$schema", true, 0);
if (!s_index_def->size()) {
- s_index_def->append_column("schema_name", SQLType::Text, AST::Order::Ascending);
+ s_index_def->append_column("schema_name", SQLType::Text, Order::Ascending);
}
return s_index_def;
}
@@ -70,15 +70,15 @@ NonnullRefPtr<IndexDef> ColumnDef::index_def()
{
NonnullRefPtr<IndexDef> s_index_def = IndexDef::construct("$column", true, 0);
if (!s_index_def->size()) {
- s_index_def->append_column("table_hash", SQLType::Integer, AST::Order::Ascending);
- s_index_def->append_column("column_number", SQLType::Integer, AST::Order::Ascending);
- s_index_def->append_column("column_name", SQLType::Text, AST::Order::Ascending);
- s_index_def->append_column("column_type", SQLType::Integer, AST::Order::Ascending);
+ s_index_def->append_column("table_hash", SQLType::Integer, Order::Ascending);
+ s_index_def->append_column("column_number", SQLType::Integer, Order::Ascending);
+ s_index_def->append_column("column_name", SQLType::Text, Order::Ascending);
+ s_index_def->append_column("column_type", SQLType::Integer, Order::Ascending);
}
return s_index_def;
}
-KeyPartDef::KeyPartDef(IndexDef* index, String name, SQLType sql_type, AST::Order sort_order)
+KeyPartDef::KeyPartDef(IndexDef* index, String name, SQLType sql_type, Order sort_order)
: ColumnDef(index, index->size(), move(name), sql_type)
, m_sort_order(sort_order)
{
@@ -96,7 +96,7 @@ IndexDef::IndexDef(String name, bool unique, u32 pointer)
{
}
-void IndexDef::append_column(String name, SQLType sql_type, AST::Order sort_order)
+void IndexDef::append_column(String name, SQLType sql_type, Order sort_order)
{
auto part = KeyPartDef::construct(this, move(name), sql_type, sort_order);
m_key_definition.append(part);
@@ -131,9 +131,9 @@ NonnullRefPtr<IndexDef> IndexDef::index_def()
{
NonnullRefPtr<IndexDef> s_index_def = IndexDef::construct("$index", true, 0);
if (!s_index_def->size()) {
- s_index_def->append_column("table_hash", SQLType::Integer, AST::Order::Ascending);
- s_index_def->append_column("index_name", SQLType::Text, AST::Order::Ascending);
- s_index_def->append_column("unique", SQLType::Integer, AST::Order::Ascending);
+ s_index_def->append_column("table_hash", SQLType::Integer, Order::Ascending);
+ s_index_def->append_column("index_name", SQLType::Text, Order::Ascending);
+ s_index_def->append_column("unique", SQLType::Integer, Order::Ascending);
}
return s_index_def;
}
@@ -149,7 +149,7 @@ TupleDescriptor TableDef::to_tuple_descriptor() const
{
TupleDescriptor ret;
for (auto& part : m_columns) {
- ret.append({ part.name(), part.type(), AST::Order::Ascending });
+ ret.append({ part.name(), part.type(), Order::Ascending });
}
return ret;
}
@@ -192,8 +192,8 @@ NonnullRefPtr<IndexDef> TableDef::index_def()
{
NonnullRefPtr<IndexDef> s_index_def = IndexDef::construct("$table", true, 0);
if (!s_index_def->size()) {
- s_index_def->append_column("schema_hash", SQLType::Integer, AST::Order::Ascending);
- s_index_def->append_column("table_name", SQLType::Text, AST::Order::Ascending);
+ s_index_def->append_column("schema_hash", SQLType::Integer, Order::Ascending);
+ s_index_def->append_column("table_name", SQLType::Text, Order::Ascending);
}
return s_index_def;
}