mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
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.
This commit is contained in:
parent
56843baff9
commit
4b70908dc4
8 changed files with 56 additions and 79 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue