@@ -5,15 +5,14 @@ import co.touchlab.sqliter.DatabaseConfiguration.Logging
55import co.touchlab.sqliter.DatabaseConnection
66import co.touchlab.sqliter.interop.Logger
77import co.touchlab.sqliter.interop.SqliteErrorType
8+ import co.touchlab.sqliter.sqlite3.sqlite3_commit_hook
9+ import co.touchlab.sqliter.sqlite3.sqlite3_enable_load_extension
10+ import co.touchlab.sqliter.sqlite3.sqlite3_load_extension
11+ import co.touchlab.sqliter.sqlite3.sqlite3_rollback_hook
12+ import co.touchlab.sqliter.sqlite3.sqlite3_update_hook
813import com.powersync.db.internal.InternalSchema
914import com.powersync.persistence.driver.NativeSqliteDriver
1015import com.powersync.persistence.driver.wrapConnection
11- import com.powersync.sqlite3.sqlite3
12- import com.powersync.sqlite3.sqlite3_commit_hook
13- import com.powersync.sqlite3.sqlite3_enable_load_extension
14- import com.powersync.sqlite3.sqlite3_load_extension
15- import com.powersync.sqlite3.sqlite3_rollback_hook
16- import com.powersync.sqlite3.sqlite3_update_hook
1716import kotlinx.cinterop.ByteVar
1817import kotlinx.cinterop.CPointerVar
1918import kotlinx.cinterop.ExperimentalForeignApi
@@ -103,7 +102,7 @@ public actual class DatabaseDriverFactory {
103102 connection : DatabaseConnection ,
104103 driver : DeferredDriver ,
105104 ) {
106- val basePointer = connection.getDbPointer().getPointer(MemScope ())
105+ val ptr = connection.getDbPointer().getPointer(MemScope ())
107106 // Try and find the bundle path for the SQLite core extension.
108107 val bundlePath =
109108 NSBundle .bundleWithIdentifier(" co.powersync.sqlitecore" )?.bundlePath
@@ -116,10 +115,6 @@ public actual class DatabaseDriverFactory {
116115 // Construct full path to the shared library inside the bundle
117116 val extensionPath = bundlePath.let { " $it /powersync-sqlite-core" }
118117
119- // We have a mix of SQLite operations. The SQliteR lib links to the system SQLite with `-lsqlite3`
120- // However we also include our own build of SQLite which is statically linked.
121- // Loading of extensions is only available using our version of SQLite's API
122- val ptr = basePointer.reinterpret< sqlite3> ()
123118 // Enable extension loading
124119 // We don't disable this after the fact, this should allow users to load their own extensions
125120 // in future.
@@ -183,13 +178,8 @@ public actual class DatabaseDriverFactory {
183178 private fun deregisterSqliteBinding (connection : DatabaseConnection ) {
184179 val basePtr = connection.getDbPointer().getPointer(MemScope ())
185180
186- // We have a mix of SQLite operations. The SQliteR lib links to the system SQLite with `-lsqlite3`
187- // However we also include our own build of SQLite which is statically linked.
188- // Loading of extensions is only available using our version of SQLite's API
189- val ptr = basePtr.reinterpret< sqlite3> ()
190-
191181 sqlite3_update_hook(
192- ptr ,
182+ basePtr.reinterpret() ,
193183 null ,
194184 null ,
195185 )
0 commit comments