summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-10-27 13:04:42 -0400
committerLinus Groh <mail@linusgroh.de>2022-11-30 11:43:13 +0100
commit0986b383cdc9e6646ce00d2f824180918aedeb93 (patch)
tree934889d5b106dedf201ce77573feb70f72f94c91
parent17988bab7518658f66c649b540a7d4b795f13fd5 (diff)
downloadserenity-0986b383cdc9e6646ce00d2f824180918aedeb93.zip
SQLServer+SQLStudio+sql: Rename a couple of SQL IPC commands for clarity
Rename sql_statement to prepare_statement and statement_execute to execute_statement. The former aligns more with other database libraries (e.g. Java's JDBC prepareStatement). The latter reads less awkwardly.
-rw-r--r--Userland/DevTools/SQLStudio/MainWidget.cpp4
-rw-r--r--Userland/Services/SQLServer/ConnectionFromClient.cpp12
-rw-r--r--Userland/Services/SQLServer/ConnectionFromClient.h4
-rw-r--r--Userland/Services/SQLServer/DatabaseConnection.cpp4
-rw-r--r--Userland/Services/SQLServer/DatabaseConnection.h2
-rw-r--r--Userland/Services/SQLServer/SQLServer.ipc4
-rw-r--r--Userland/Utilities/sql.cpp4
7 files changed, 17 insertions, 17 deletions
diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp
index 9c8917f3b7..929ed1dff6 100644
--- a/Userland/DevTools/SQLStudio/MainWidget.cpp
+++ b/Userland/DevTools/SQLStudio/MainWidget.cpp
@@ -478,8 +478,8 @@ String MainWidget::read_next_sql_statement_of_editor()
m_editor_line_level = last_token_ended_statement ? 0 : (m_editor_line_level > 0 ? m_editor_line_level : 1);
} while ((m_editor_line_level > 0) || piece.is_empty());
- auto statement_id = m_sql_client->sql_statement(m_connection_id, piece.to_string());
- m_sql_client->async_statement_execute(statement_id);
+ auto statement_id = m_sql_client->prepare_statement(m_connection_id, piece.to_string());
+ m_sql_client->async_execute_statement(statement_id);
return piece.to_string();
}
diff --git a/Userland/Services/SQLServer/ConnectionFromClient.cpp b/Userland/Services/SQLServer/ConnectionFromClient.cpp
index 97ac76d324..6ff4d89603 100644
--- a/Userland/Services/SQLServer/ConnectionFromClient.cpp
+++ b/Userland/Services/SQLServer/ConnectionFromClient.cpp
@@ -51,13 +51,13 @@ void ConnectionFromClient::disconnect(int connection_id)
dbgln("Database connection has disappeared");
}
-Messages::SQLServer::SqlStatementResponse ConnectionFromClient::sql_statement(int connection_id, String const& sql)
+Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_statement(int connection_id, String const& sql)
{
- dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::sql_statement(connection_id: {}, sql: '{}')", connection_id, sql);
+ dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::prepare_statement(connection_id: {}, sql: '{}')", connection_id, sql);
auto database_connection = DatabaseConnection::connection_for(connection_id);
if (database_connection) {
- auto statement_id = database_connection->sql_statement(sql);
- dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::sql_statement -> statement_id = {}", statement_id);
+ auto statement_id = database_connection->prepare_statement(sql);
+ dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::prepare_statement -> statement_id = {}", statement_id);
return { statement_id };
} else {
dbgln("Database connection has disappeared");
@@ -65,9 +65,9 @@ Messages::SQLServer::SqlStatementResponse ConnectionFromClient::sql_statement(in
}
}
-void ConnectionFromClient::statement_execute(int statement_id)
+void ConnectionFromClient::execute_statement(int statement_id)
{
- dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::statement_execute_query(statement_id: {})", statement_id);
+ dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::execute_query_statement(statement_id: {})", statement_id);
auto statement = SQLStatement::statement_for(statement_id);
if (statement && statement->connection()->client_id() == client_id()) {
statement->execute();
diff --git a/Userland/Services/SQLServer/ConnectionFromClient.h b/Userland/Services/SQLServer/ConnectionFromClient.h
index 1da9d87043..df4ed217d5 100644
--- a/Userland/Services/SQLServer/ConnectionFromClient.h
+++ b/Userland/Services/SQLServer/ConnectionFromClient.h
@@ -28,8 +28,8 @@ private:
explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id);
virtual Messages::SQLServer::ConnectResponse connect(String const&) override;
- virtual Messages::SQLServer::SqlStatementResponse sql_statement(int, String const&) override;
- virtual void statement_execute(int) override;
+ virtual Messages::SQLServer::PrepareStatementResponse prepare_statement(int, String const&) override;
+ virtual void execute_statement(int) override;
virtual void disconnect(int) override;
};
diff --git a/Userland/Services/SQLServer/DatabaseConnection.cpp b/Userland/Services/SQLServer/DatabaseConnection.cpp
index 1127848cf5..723af326cb 100644
--- a/Userland/Services/SQLServer/DatabaseConnection.cpp
+++ b/Userland/Services/SQLServer/DatabaseConnection.cpp
@@ -67,9 +67,9 @@ void DatabaseConnection::disconnect()
});
}
-int DatabaseConnection::sql_statement(String const& sql)
+int DatabaseConnection::prepare_statement(String const& sql)
{
- dbgln_if(SQLSERVER_DEBUG, "DatabaseConnection::sql_statement(connection_id {}, database '{}', sql '{}'", connection_id(), m_database_name, sql);
+ dbgln_if(SQLSERVER_DEBUG, "DatabaseConnection::prepare_statement(connection_id {}, database '{}', sql '{}'", connection_id(), m_database_name, sql);
auto client_connection = ConnectionFromClient::client_connection_for(client_id());
if (!client_connection) {
warnln("Cannot notify client of database disconnection. Client disconnected");
diff --git a/Userland/Services/SQLServer/DatabaseConnection.h b/Userland/Services/SQLServer/DatabaseConnection.h
index 068c27bcdc..45f7ac25e8 100644
--- a/Userland/Services/SQLServer/DatabaseConnection.h
+++ b/Userland/Services/SQLServer/DatabaseConnection.h
@@ -23,7 +23,7 @@ public:
int client_id() const { return m_client_id; }
RefPtr<SQL::Database> database() { return m_database; }
void disconnect();
- int sql_statement(String const& sql);
+ int prepare_statement(String const& sql);
private:
DatabaseConnection(String database_name, int client_id);
diff --git a/Userland/Services/SQLServer/SQLServer.ipc b/Userland/Services/SQLServer/SQLServer.ipc
index af871151e3..2a11df565d 100644
--- a/Userland/Services/SQLServer/SQLServer.ipc
+++ b/Userland/Services/SQLServer/SQLServer.ipc
@@ -1,7 +1,7 @@
endpoint SQLServer
{
connect(String name) => (int connection_id)
- sql_statement(int connection_id, String statement) => (int statement_id)
- statement_execute(int statement_id) =|
+ prepare_statement(int connection_id, String statement) => (int statement_id)
+ execute_statement(int statement_id) =|
disconnect(int connection_id) =|
}
diff --git a/Userland/Utilities/sql.cpp b/Userland/Utilities/sql.cpp
index 309e685288..b9456a76d3 100644
--- a/Userland/Utilities/sql.cpp
+++ b/Userland/Utilities/sql.cpp
@@ -291,8 +291,8 @@ private:
read_sql();
});
} else {
- auto statement_id = m_sql_client->sql_statement(m_connection_id, piece);
- m_sql_client->async_statement_execute(statement_id);
+ auto statement_id = m_sql_client->prepare_statement(m_connection_id, piece);
+ m_sql_client->async_execute_statement(statement_id);
}
// ...But m_keep_running can also be set to false by a command handler.