summaryrefslogtreecommitdiff
path: root/Userland/DevTools
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-12-03 11:34:30 -0500
committerAndreas Kling <kling@serenityos.org>2022-12-07 13:09:00 +0100
commitb9d8c25b0bfcf902bfceffb0ff7576c8d4256157 (patch)
tree19b402d872d57c8e6772dd065dbfe0b79815259d /Userland/DevTools
parent27ce88864fde1b0ed4122cb77ad555dda50974c9 (diff)
downloadserenity-b9d8c25b0bfcf902bfceffb0ff7576c8d4256157.zip
LibSQL+SQLServer+SQLStudio+sql: Send result rows over IPC as SQL::Value
We've been sending the values converted to a string, but now that the Value type is transferrable over IPC, send the values themselves. Any client that wants the value as a string may do so easily, whereas this will allow less trivial clients to avoid string parsing.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r--Userland/DevTools/SQLStudio/MainWidget.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp
index f47b5a8e9e..31d31d6f26 100644
--- a/Userland/DevTools/SQLStudio/MainWidget.cpp
+++ b/Userland/DevTools/SQLStudio/MainWidget.cpp
@@ -24,6 +24,7 @@
#include <LibSQL/AST/Lexer.h>
#include <LibSQL/AST/Token.h>
#include <LibSQL/SQLClient.h>
+#include <LibSQL/Value.h>
#include "MainWidget.h"
#include "ScriptEditor.h"
@@ -224,8 +225,12 @@ MainWidget::MainWidget()
m_sql_client->on_execution_success = [this](auto, auto, auto, auto, auto, auto) {
read_next_sql_statement_of_editor();
};
- m_sql_client->on_next_result = [this](auto, auto, auto const& row) {
- m_results.append(row);
+ m_sql_client->on_next_result = [this](auto, auto, auto row) {
+ m_results.append({});
+ m_results.last().ensure_capacity(row.size());
+
+ for (auto const& value : row)
+ m_results.last().unchecked_append(value.to_deprecated_string());
};
m_sql_client->on_results_exhausted = [this](auto, auto, auto) {
if (m_results.size() == 0)