summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-12-28 10:48:38 -0500
committerAndreas Kling <kling@serenityos.org>2022-12-30 14:17:18 +0100
commit21255cb2b886007c8013045ed63ec1cbc9be0ab2 (patch)
tree9fcb8f5fa19cd4f7a35d32a7ffc33b875784528b /Userland/Services
parent51b69be970757340deb3dc37a9768ada2b5819d9 (diff)
downloadserenity-21255cb2b886007c8013045ed63ec1cbc9be0ab2.zip
SQLServer: Explicitly return empty optionals over IPC upon errors
These are currently hitting the `decltype(nullptr)` constructor, which marks the response as invalid, resulting in no response being sent to the waiting client.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/SQLServer/ConnectionFromClient.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Services/SQLServer/ConnectionFromClient.cpp b/Userland/Services/SQLServer/ConnectionFromClient.cpp
index f45a3a3125..f4b5ec2ce0 100644
--- a/Userland/Services/SQLServer/ConnectionFromClient.cpp
+++ b/Userland/Services/SQLServer/ConnectionFromClient.cpp
@@ -49,7 +49,7 @@ Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(DeprecatedStr
if (auto database_connection = DatabaseConnection::create(m_database_path, database_name, client_id()); !database_connection.is_error())
return { database_connection.value()->connection_id() };
- return { {} };
+ return Optional<SQL::ConnectionID> {};
}
void ConnectionFromClient::disconnect(SQL::ConnectionID connection_id)
@@ -69,13 +69,13 @@ Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_stat
auto database_connection = DatabaseConnection::connection_for(connection_id);
if (!database_connection) {
dbgln("Database connection has disappeared");
- return { {} };
+ return Optional<SQL::StatementID> {};
}
auto result = database_connection->prepare_statement(sql);
if (result.is_error()) {
dbgln_if(SQLSERVER_DEBUG, "Could not parse SQL statement: {}", result.error().error_string());
- return { {} };
+ return Optional<SQL::StatementID> {};
}
dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::prepare_statement -> statement_id = {}", result.value());
@@ -94,7 +94,7 @@ Messages::SQLServer::ExecuteStatementResponse ConnectionFromClient::execute_stat
dbgln_if(SQLSERVER_DEBUG, "Statement has disappeared");
async_execution_error(statement_id, -1, SQL::SQLErrorCode::StatementUnavailable, DeprecatedString::formatted("{}", statement_id));
- return { {} };
+ return Optional<SQL::ExecutionID> {};
}
}