diff --git a/Userland/Libraries/LibSQL/AST/Delete.cpp b/Userland/Libraries/LibSQL/AST/Delete.cpp index d2c87dfb6e..a36e15c356 100644 --- a/Userland/Libraries/LibSQL/AST/Delete.cpp +++ b/Userland/Libraries/LibSQL/AST/Delete.cpp @@ -31,6 +31,7 @@ ResultOr Delete::execute(ExecutionContext& context) const TRY(context.database->remove(table_row)); // FIXME: Implement the RETURNING clause. + result.insert_row(table_row, {}); } return result; diff --git a/Userland/Services/SQLServer/SQLStatement.cpp b/Userland/Services/SQLServer/SQLStatement.cpp index 1b89b4e395..0b30c013d1 100644 --- a/Userland/Services/SQLServer/SQLStatement.cpp +++ b/Userland/Services/SQLServer/SQLStatement.cpp @@ -94,7 +94,14 @@ Optional SQLStatement::execute(Vector placeholder_values) auto result_size = result.size(); next(execution_id, move(result), result_size); } else { - client_connection->async_execution_success(statement_id(), execution_id, false, 0, result.size(), 0); + if (result.command() == SQL::SQLCommand::Insert) + client_connection->async_execution_success(statement_id(), execution_id, false, result.size(), 0, 0); + else if (result.command() == SQL::SQLCommand::Update) + client_connection->async_execution_success(statement_id(), execution_id, false, 0, result.size(), 0); + else if (result.command() == SQL::SQLCommand::Delete) + client_connection->async_execution_success(statement_id(), execution_id, false, 0, 0, result.size()); + else + client_connection->async_execution_success(statement_id(), execution_id, false, 0, 0, 0); } }); diff --git a/Userland/Utilities/sql.cpp b/Userland/Utilities/sql.cpp index 864a3918ef..1869edbd2b 100644 --- a/Userland/Utilities/sql.cpp +++ b/Userland/Utilities/sql.cpp @@ -76,9 +76,9 @@ public: m_sql_client = SQL::SQLClient::try_create().release_value_but_fixme_should_propagate_errors(); - m_sql_client->on_execution_success = [this](auto, auto, auto has_results, auto updated, auto created, auto deleted) { + m_sql_client->on_execution_success = [this](auto, auto, auto has_results, auto created, auto updated, auto deleted) { if (updated != 0 || created != 0 || deleted != 0) { - outln("{} row(s) updated, {} created, {} deleted", updated, created, deleted); + outln("{} row(s) created, {} updated, {} deleted", created, updated, deleted); } if (!has_results) { read_sql();