mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
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.
This commit is contained in:
parent
17988bab75
commit
0986b383cd
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) =|
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue