mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:47:46 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibSQL/Result.h>
|
||||
#include <SQLServer/ConnectionFromClient.h>
|
||||
|
@ -34,7 +34,7 @@ void ConnectionFromClient::die()
|
|||
s_connections.remove(client_id());
|
||||
}
|
||||
|
||||
Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(String const& database_name)
|
||||
Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(DeprecatedString const& database_name)
|
||||
{
|
||||
dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::connect(database_name: {})", database_name);
|
||||
auto database_connection = DatabaseConnection::construct(database_name, client_id());
|
||||
|
@ -51,7 +51,7 @@ void ConnectionFromClient::disconnect(int connection_id)
|
|||
dbgln("Database connection has disappeared");
|
||||
}
|
||||
|
||||
Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_statement(int connection_id, String const& sql)
|
||||
Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_statement(int connection_id, DeprecatedString const& sql)
|
||||
{
|
||||
dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::prepare_statement(connection_id: {}, sql: '{}')", connection_id, sql);
|
||||
auto database_connection = DatabaseConnection::connection_for(connection_id);
|
||||
|
@ -73,7 +73,7 @@ void ConnectionFromClient::execute_statement(int statement_id)
|
|||
statement->execute();
|
||||
} else {
|
||||
dbgln_if(SQLSERVER_DEBUG, "Statement has disappeared");
|
||||
async_execution_error(statement_id, (int)SQL::SQLErrorCode::StatementUnavailable, String::formatted("{}", statement_id));
|
||||
async_execution_error(statement_id, (int)SQL::SQLErrorCode::StatementUnavailable, DeprecatedString::formatted("{}", statement_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ public:
|
|||
private:
|
||||
explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::SQLServer::ConnectResponse connect(String const&) override;
|
||||
virtual Messages::SQLServer::PrepareStatementResponse prepare_statement(int, String const&) override;
|
||||
virtual Messages::SQLServer::ConnectResponse connect(DeprecatedString const&) override;
|
||||
virtual Messages::SQLServer::PrepareStatementResponse prepare_statement(int, DeprecatedString const&) override;
|
||||
virtual void execute_statement(int) override;
|
||||
virtual void disconnect(int) override;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ RefPtr<DatabaseConnection> DatabaseConnection::connection_for(int connection_id)
|
|||
|
||||
static int s_next_connection_id = 0;
|
||||
|
||||
DatabaseConnection::DatabaseConnection(String database_name, int client_id)
|
||||
DatabaseConnection::DatabaseConnection(DeprecatedString database_name, int client_id)
|
||||
: Object()
|
||||
, m_database_name(move(database_name))
|
||||
, m_connection_id(s_next_connection_id++)
|
||||
|
@ -38,7 +38,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id)
|
|||
dbgln_if(SQLSERVER_DEBUG, "DatabaseConnection {} initiating connection with database '{}'", connection_id(), m_database_name);
|
||||
s_connections.set(m_connection_id, *this);
|
||||
deferred_invoke([this]() {
|
||||
m_database = SQL::Database::construct(String::formatted("/home/anon/sql/{}.db", m_database_name));
|
||||
m_database = SQL::Database::construct(DeprecatedString::formatted("/home/anon/sql/{}.db", m_database_name));
|
||||
auto client_connection = ConnectionFromClient::client_connection_for(m_client_id);
|
||||
if (auto maybe_error = m_database->open(); maybe_error.is_error()) {
|
||||
client_connection->async_connection_error(m_connection_id, to_underlying(maybe_error.error().error()), maybe_error.error().error_string());
|
||||
|
@ -67,7 +67,7 @@ void DatabaseConnection::disconnect()
|
|||
});
|
||||
}
|
||||
|
||||
int DatabaseConnection::prepare_statement(String const& sql)
|
||||
int DatabaseConnection::prepare_statement(DeprecatedString const& 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());
|
||||
|
|
|
@ -23,13 +23,13 @@ public:
|
|||
int client_id() const { return m_client_id; }
|
||||
RefPtr<SQL::Database> database() { return m_database; }
|
||||
void disconnect();
|
||||
int prepare_statement(String const& sql);
|
||||
int prepare_statement(DeprecatedString const& sql);
|
||||
|
||||
private:
|
||||
DatabaseConnection(String database_name, int client_id);
|
||||
DatabaseConnection(DeprecatedString database_name, int client_id);
|
||||
|
||||
RefPtr<SQL::Database> m_database { nullptr };
|
||||
String m_database_name;
|
||||
DeprecatedString m_database_name;
|
||||
int m_connection_id;
|
||||
int m_client_id;
|
||||
bool m_accept_statements { false };
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
endpoint SQLClient
|
||||
{
|
||||
connected(int connection_id, String connected_to_database) =|
|
||||
connection_error(int connection_id, int code, String message) =|
|
||||
connected(int connection_id, DeprecatedString connected_to_database) =|
|
||||
connection_error(int connection_id, int code, DeprecatedString message) =|
|
||||
execution_success(int statement_id, bool has_results, int created, int updated, int deleted) =|
|
||||
next_result(int statement_id, Vector<String> row) =|
|
||||
next_result(int statement_id, Vector<DeprecatedString> row) =|
|
||||
results_exhausted(int statement_id, int total_rows) =|
|
||||
execution_error(int statement_id, int code, String message) =|
|
||||
execution_error(int statement_id, int code, DeprecatedString message) =|
|
||||
disconnected(int connection_id) =|
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
endpoint SQLServer
|
||||
{
|
||||
connect(String name) => (int connection_id)
|
||||
prepare_statement(int connection_id, String statement) => (int statement_id)
|
||||
connect(DeprecatedString name) => (int connection_id)
|
||||
prepare_statement(int connection_id, DeprecatedString statement) => (int statement_id)
|
||||
execute_statement(int statement_id) =|
|
||||
disconnect(int connection_id) =|
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ RefPtr<SQLStatement> SQLStatement::statement_for(int statement_id)
|
|||
|
||||
static int s_next_statement_id = 0;
|
||||
|
||||
SQLStatement::SQLStatement(DatabaseConnection& connection, String sql)
|
||||
SQLStatement::SQLStatement(DatabaseConnection& connection, DeprecatedString sql)
|
||||
: Core::Object(&connection)
|
||||
, m_statement_id(s_next_statement_id++)
|
||||
, m_sql(move(sql))
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibSQL/AST/AST.h>
|
||||
#include <LibSQL/Result.h>
|
||||
|
@ -25,19 +25,19 @@ public:
|
|||
|
||||
static RefPtr<SQLStatement> statement_for(int statement_id);
|
||||
int statement_id() const { return m_statement_id; }
|
||||
String const& sql() const { return m_sql; }
|
||||
DeprecatedString const& sql() const { return m_sql; }
|
||||
DatabaseConnection* connection() { return dynamic_cast<DatabaseConnection*>(parent()); }
|
||||
void execute();
|
||||
|
||||
private:
|
||||
SQLStatement(DatabaseConnection&, String sql);
|
||||
SQLStatement(DatabaseConnection&, DeprecatedString sql);
|
||||
SQL::ResultOr<void> parse();
|
||||
bool should_send_result_rows() const;
|
||||
void next();
|
||||
void report_error(SQL::Result);
|
||||
|
||||
int m_statement_id;
|
||||
String m_sql;
|
||||
DeprecatedString m_sql;
|
||||
size_t m_index { 0 };
|
||||
RefPtr<SQL::AST::Statement> m_statement { nullptr };
|
||||
Optional<SQL::ResultSet> m_result {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue