mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +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:
parent
5c5a00dd3a
commit
e26ead0995
5 changed files with 18 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue