1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:37:44 +00:00

Ladybird+LibWebView: Move creation of the SQL client to LibWebView

This lets us remove the direct dependency from Ladybird to LibSQL.
This commit is contained in:
Timothy Flynn 2023-08-31 07:21:54 -04:00 committed by Andreas Kling
parent 5c5a00dd3a
commit e26ead0995
5 changed files with 18 additions and 8 deletions

View file

@ -17,6 +17,16 @@ ErrorOr<NonnullRefPtr<Database>> Database::create()
return create(move(sql_client));
}
#if !defined(AK_OS_SERENITY)
ErrorOr<NonnullRefPtr<Database>> Database::create(Vector<String> candidate_sql_server_paths)
{
auto sql_client = TRY(SQL::SQLClient::launch_server_and_create_client(move(candidate_sql_server_paths)));
return create(move(sql_client));
}
#endif
ErrorOr<NonnullRefPtr<Database>> Database::create(NonnullRefPtr<SQL::SQLClient> sql_client)
{
auto connection_id = sql_client->connect(database_name);

View file

@ -29,7 +29,9 @@ class Database : public RefCounted<Database> {
public:
static ErrorOr<NonnullRefPtr<Database>> create();
static ErrorOr<NonnullRefPtr<Database>> create(NonnullRefPtr<SQL::SQLClient>);
#if !defined(AK_OS_SERENITY)
static ErrorOr<NonnullRefPtr<Database>> create(Vector<String> candidate_sql_server_paths);
#endif
ErrorOr<SQL::StatementID> prepare_statement(StringView statement);
@ -57,6 +59,8 @@ public:
}
private:
static ErrorOr<NonnullRefPtr<Database>> create(NonnullRefPtr<SQL::SQLClient>);
struct ExecutionKey {
constexpr bool operator==(ExecutionKey const&) const = default;