summaryrefslogtreecommitdiff
path: root/Userland/Services/SQLServer
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-29 08:24:15 -0500
committerLinus Groh <mail@linusgroh.de>2022-11-30 11:43:13 +0100
commit56843baff928a31e5b4520e38b36dd0de35acd9f (patch)
tree6a9270ad5a0db91ed9700fa6192b6fac2d6073fb /Userland/Services/SQLServer
parent7464dfa974fce3845ab2fb609b2d1df31f911814 (diff)
downloadserenity-56843baff928a31e5b4520e38b36dd0de35acd9f.zip
LibSQL+SQLServer: Return a NonnullRefPtr from Database::get_schema
Database::get_schema currently either returns a RefPtr to an existing schema, a nullptr if the schema doesn't exist, or an Error if some internal error occured. Change this to return a NonnullRefPtr to an exisiting schema, or a SQL::Result with any error, including if the schema 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/Services/SQLServer')
-rw-r--r--Userland/Services/SQLServer/DatabaseConnection.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Services/SQLServer/DatabaseConnection.cpp b/Userland/Services/SQLServer/DatabaseConnection.cpp
index 723af326cb..ce76b3d248 100644
--- a/Userland/Services/SQLServer/DatabaseConnection.cpp
+++ b/Userland/Services/SQLServer/DatabaseConnection.cpp
@@ -41,7 +41,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id)
m_database = SQL::Database::construct(String::formatted("/home/anon/sql/{}.db", m_database_name));
auto client_connection = ConnectionFromClient::client_connection_for(m_client_id);
if (auto maybe_error = m_database->open(); maybe_error.is_error()) {
- client_connection->async_connection_error(m_connection_id, (int)SQL::SQLErrorCode::InternalError, maybe_error.error().string_literal());
+ client_connection->async_connection_error(m_connection_id, to_underlying(maybe_error.error().error()), maybe_error.error().error_string());
return;
}
m_accept_statements = true;