mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:17:45 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -23,14 +23,14 @@ RefPtr<ConnectionFromClient> ConnectionFromClient::client_connection_for(int cli
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_database_path(DeprecatedString database_path)
|
||||
void ConnectionFromClient::set_database_path(ByteString database_path)
|
||||
{
|
||||
m_database_path = move(database_path);
|
||||
}
|
||||
|
||||
ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::LocalSocket> socket, int client_id)
|
||||
: IPC::ConnectionFromClient<SQLClientEndpoint, SQLServerEndpoint>(*this, move(socket), client_id)
|
||||
, m_database_path(DeprecatedString::formatted("{}/sql", Core::StandardPaths::data_directory()))
|
||||
, m_database_path(ByteString::formatted("{}/sql", Core::StandardPaths::data_directory()))
|
||||
{
|
||||
s_connections.set(client_id, *this);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ void ConnectionFromClient::die()
|
|||
on_disconnect();
|
||||
}
|
||||
|
||||
Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(DeprecatedString const& database_name)
|
||||
Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(ByteString const& database_name)
|
||||
{
|
||||
dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::connect(database_name: {})", database_name);
|
||||
|
||||
|
@ -62,7 +62,7 @@ void ConnectionFromClient::disconnect(SQL::ConnectionID connection_id)
|
|||
dbgln("Database connection has disappeared");
|
||||
}
|
||||
|
||||
Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_statement(SQL::ConnectionID connection_id, DeprecatedString const& sql)
|
||||
Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_statement(SQL::ConnectionID connection_id, ByteString const& sql)
|
||||
{
|
||||
dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::prepare_statement(connection_id: {}, sql: '{}')", connection_id, sql);
|
||||
|
||||
|
@ -93,7 +93,7 @@ Messages::SQLServer::ExecuteStatementResponse ConnectionFromClient::execute_stat
|
|||
}
|
||||
|
||||
dbgln_if(SQLSERVER_DEBUG, "Statement has disappeared");
|
||||
async_execution_error(statement_id, -1, SQL::SQLErrorCode::StatementUnavailable, DeprecatedString::formatted("{}", statement_id));
|
||||
async_execution_error(statement_id, -1, SQL::SQLErrorCode::StatementUnavailable, ByteString::formatted("{}", statement_id));
|
||||
return Optional<SQL::ExecutionID> {};
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Vector.h>
|
||||
|
@ -28,18 +28,18 @@ public:
|
|||
|
||||
static RefPtr<ConnectionFromClient> client_connection_for(int client_id);
|
||||
|
||||
void set_database_path(DeprecatedString);
|
||||
void set_database_path(ByteString);
|
||||
Function<void()> on_disconnect;
|
||||
|
||||
private:
|
||||
explicit ConnectionFromClient(NonnullOwnPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::SQLServer::ConnectResponse connect(DeprecatedString const&) override;
|
||||
virtual Messages::SQLServer::PrepareStatementResponse prepare_statement(SQL::ConnectionID, DeprecatedString const&) override;
|
||||
virtual Messages::SQLServer::ConnectResponse connect(ByteString const&) override;
|
||||
virtual Messages::SQLServer::PrepareStatementResponse prepare_statement(SQL::ConnectionID, ByteString const&) override;
|
||||
virtual Messages::SQLServer::ExecuteStatementResponse execute_statement(SQL::StatementID, Vector<SQL::Value> const& placeholder_values) override;
|
||||
virtual void disconnect(SQL::ConnectionID) override;
|
||||
|
||||
DeprecatedString m_database_path;
|
||||
ByteString m_database_path;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ static ErrorOr<NonnullRefPtr<SQL::Database>> find_or_create_database(StringView
|
|||
return connection.value->database();
|
||||
}
|
||||
|
||||
auto database_file = DeprecatedString::formatted("{}/{}.db", database_path, database_name);
|
||||
auto database_file = ByteString::formatted("{}/{}.db", database_path, database_name);
|
||||
return SQL::Database::create(move(database_file));
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ RefPtr<DatabaseConnection> DatabaseConnection::connection_for(SQL::ConnectionID
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<DatabaseConnection>> DatabaseConnection::create(StringView database_path, DeprecatedString database_name, int client_id)
|
||||
ErrorOr<NonnullRefPtr<DatabaseConnection>> DatabaseConnection::create(StringView database_path, ByteString database_name, int client_id)
|
||||
{
|
||||
if (LexicalPath path(database_name); (path.title() != database_name) || (path.dirname() != "."))
|
||||
return Error::from_string_view("Invalid database name"sv);
|
||||
|
@ -48,7 +48,7 @@ ErrorOr<NonnullRefPtr<DatabaseConnection>> DatabaseConnection::create(StringView
|
|||
return adopt_nonnull_ref_or_enomem(new (nothrow) DatabaseConnection(move(database), move(database_name), client_id));
|
||||
}
|
||||
|
||||
DatabaseConnection::DatabaseConnection(NonnullRefPtr<SQL::Database> database, DeprecatedString database_name, int client_id)
|
||||
DatabaseConnection::DatabaseConnection(NonnullRefPtr<SQL::Database> database, ByteString database_name, int client_id)
|
||||
: m_database(move(database))
|
||||
, m_database_name(move(database_name))
|
||||
, m_connection_id(s_next_connection_id++)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace SQLServer {
|
|||
|
||||
class DatabaseConnection final : public RefCounted<DatabaseConnection> {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<DatabaseConnection>> create(StringView database_path, DeprecatedString database_name, int client_id);
|
||||
static ErrorOr<NonnullRefPtr<DatabaseConnection>> create(StringView database_path, ByteString database_name, int client_id);
|
||||
|
||||
static RefPtr<DatabaseConnection> connection_for(SQL::ConnectionID connection_id);
|
||||
SQL::ConnectionID connection_id() const { return m_connection_id; }
|
||||
|
@ -28,10 +28,10 @@ public:
|
|||
SQL::ResultOr<SQL::StatementID> prepare_statement(StringView sql);
|
||||
|
||||
private:
|
||||
DatabaseConnection(NonnullRefPtr<SQL::Database> database, DeprecatedString database_name, int client_id);
|
||||
DatabaseConnection(NonnullRefPtr<SQL::Database> database, ByteString database_name, int client_id);
|
||||
|
||||
NonnullRefPtr<SQL::Database> m_database;
|
||||
DeprecatedString m_database_name;
|
||||
ByteString m_database_name;
|
||||
SQL::ConnectionID m_connection_id { 0 };
|
||||
int m_client_id { 0 };
|
||||
};
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
endpoint SQLClient
|
||||
{
|
||||
execution_success(u64 statement_id, u64 execution_id, Vector<DeprecatedString> column_names, bool has_results, size_t created, size_t updated, size_t deleted) =|
|
||||
execution_success(u64 statement_id, u64 execution_id, Vector<ByteString> column_names, bool has_results, size_t created, size_t updated, size_t deleted) =|
|
||||
next_result(u64 statement_id, u64 execution_id, Vector<SQL::Value> row) =|
|
||||
results_exhausted(u64 statement_id, u64 execution_id, size_t total_rows) =|
|
||||
execution_error(u64 statement_id, u64 execution_id, SQL::SQLErrorCode code, DeprecatedString message) =|
|
||||
execution_error(u64 statement_id, u64 execution_id, SQL::SQLErrorCode code, ByteString message) =|
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
endpoint SQLServer
|
||||
{
|
||||
connect(DeprecatedString name) => (Optional<u64> connection_id)
|
||||
prepare_statement(u64 connection_id, DeprecatedString statement) => (Optional<u64> statement_id)
|
||||
connect(ByteString name) => (Optional<u64> connection_id)
|
||||
prepare_statement(u64 connection_id, ByteString statement) => (Optional<u64> statement_id)
|
||||
execute_statement(u64 statement_id, Vector<SQL::Value> placeholder_values) => (Optional<u64> execution_id)
|
||||
disconnect(u64 connection_id) => ()
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ SQL::ResultOr<NonnullRefPtr<SQLStatement>> SQLStatement::create(DatabaseConnecti
|
|||
auto statement = parser.next_statement();
|
||||
|
||||
if (parser.has_errors())
|
||||
return SQL::Result { SQL::SQLCommand::Unknown, SQL::SQLErrorCode::SyntaxError, parser.errors()[0].to_deprecated_string() };
|
||||
return SQL::Result { SQL::SQLCommand::Unknown, SQL::SQLErrorCode::SyntaxError, parser.errors()[0].to_byte_string() };
|
||||
|
||||
return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) SQLStatement(connection, move(statement))));
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio accept unix rpath wpath cpath"));
|
||||
|
||||
auto database_path = DeprecatedString::formatted("{}/sql", Core::StandardPaths::data_directory());
|
||||
auto database_path = ByteString::formatted("{}/sql", Core::StandardPaths::data_directory());
|
||||
TRY(Core::Directory::create(database_path, Core::Directory::CreateDirectories::Yes));
|
||||
|
||||
TRY(Core::System::unveil(database_path, "rwc"sv));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue