summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSQL/Database.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-29 08:47:22 -0500
committerLinus Groh <mail@linusgroh.de>2022-11-30 11:43:13 +0100
commit4b70908dc4c249f8b292b8a617afbc6adb824a4f (patch)
tree2b62766f3c786e781cc086aba1fb4a322fc50379 /Userland/Libraries/LibSQL/Database.h
parent56843baff928a31e5b4520e38b36dd0de35acd9f (diff)
downloadserenity-4b70908dc4c249f8b292b8a617afbc6adb824a4f.zip
LibSQL+SQLServer: Return a NonnullRefPtr from Database::get_table
Database::get_table currently either returns a RefPtr to an existing table, a nullptr if the table doesn't exist, or an Error if some internal error occured. Change this to return a NonnullRefPtr to an exisiting table, or a SQL::Result with any error, including if the table was not found. Callers can then handle that specific error code if they want. Returning a NonnullRefPtr will enable some further cleanup. This had some fallout of needing to change some other methods' return types from AK::ErrorOr to SQL::Result so that TRY may continue to be used.
Diffstat (limited to 'Userland/Libraries/LibSQL/Database.h')
-rw-r--r--Userland/Libraries/LibSQL/Database.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibSQL/Database.h b/Userland/Libraries/LibSQL/Database.h
index 29c97c089c..baf7ebb709 100644
--- a/Userland/Libraries/LibSQL/Database.h
+++ b/Userland/Libraries/LibSQL/Database.h
@@ -37,9 +37,9 @@ public:
static Key get_schema_key(String const&);
ResultOr<NonnullRefPtr<SchemaDef>> get_schema(String const&);
- ErrorOr<void> add_table(TableDef& table);
+ ResultOr<void> add_table(TableDef& table);
static Key get_table_key(String const&, String const&);
- ResultOr<RefPtr<TableDef>> get_table(String const&, String const&);
+ ResultOr<NonnullRefPtr<TableDef>> get_table(String const&, String const&);
ErrorOr<Vector<Row>> select_all(TableDef const&);
ErrorOr<Vector<Row>> match(TableDef const&, Key const&);
@@ -57,7 +57,7 @@ private:
RefPtr<BTree> m_table_columns;
HashMap<u32, NonnullRefPtr<SchemaDef>> m_schema_cache;
- HashMap<u32, RefPtr<TableDef>> m_table_cache;
+ HashMap<u32, NonnullRefPtr<TableDef>> m_table_cache;
};
}