Skip to content

Use androidx sqlite bindings internally #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

simolus3
Copy link
Contributor

@simolus3 simolus3 commented Jul 25, 2025

This restructures our internal driver implementations to be aligned with cross-platform APIs from the androidx.sqlite:sqlite library, and removes all internal usages of SQLiter and SQLDelight:

  • The :persistence project has been removed.
  • The :dialect project has been removed.

As a replacement, I've introduced the internal :drivers:common project which adds a common interface for raw SQLite connections and statements. It re-uses the androidx.sqlite definitions, but adds a driver that allows adding update and commit hooks (for which androidx.sqlite has no API yet)). On native platforms, I'm using the androidx.sqlite:sqlite-framework implementation. On the JVM, I've moved the sqlite-jdbc implementation from :core to :drivers:common.

In :core, the public interfaces like the cursor are then consistently implemented across the common underlying SQLiteConnection API.

I've also added a new API to PowerSyncDatabase to give out a temporary view to an underlying SQLiteConnection. This would give users full control over the statements to run, while still letting the PowerSync SDK taking care of connection management.

This is only a first step, but I hope that it makes it easier to introduce more features in the future, such as:

  1. Splitting :drivers:common into :drivers:sqlite3 and :drivers:sqlcipher, and then letting users swap out driver implementations if they want an encrypted database.
  2. Allowing the use of custom driver implementations, which could allow the SDK to e.g. share a connection pool with GRDB in the future.
  3. Supporting custom database paths on all platforms.
  4. Supporting otherr SQLite toolkits like Room or SQLDelight.

TODOs:

  • Check Swift SDK still works with this.
  • Check we're using the same paths as SQLiter by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant