Mithesh
(Mithesh)
1
I tried to implement the sqlite3_preupdate_hook(). But in the documentation SQlite docs they have asked to enable the compilation flag to get the method. How to enable the compilation flag and get the access of sqlite3_preupdate_hook().
mrtksn
(Mertol Kasanan)
2
One option is to integrate SQLite through Swift Package Manager and provide the options you want from there.
Take a look at the Vapor's SQLite-nio implementation: https://github.com/vapor/sqlite-nio/blob/main/Package.swift
Mithesh
(Mithesh)
3
Hey. I integrated SQLite through Swift Package Manager. After integrating, when I tried to use the sqlite3_preupdate_hook() I got this error: "Cannot find 'sqlite3_preupdate_hook' in scope".
mrtksn
(Mertol Kasanan)
4
If you took the SQLite C code from that package, it's probably sqlite_nio_sqlite3_preupdate_hook().
Mithesh
(Mithesh)
5
Yeah I took it from NIO. I used this method sqlite_nio_sqlite3_preupdate_hook(). But still I got this "sqlite_nio_sqlite3_preupdate_hook()" not found error.
mrtksn
(Mertol Kasanan)
8
Okay, I tried it myself and it works.
I think you might have some other issue with your implementation and it's hard to find it without knowing your implementation. Is sqlite3_preupdate_hook() the only function that is missing for example? Can you use the rest of the C API? Can you open a connection?
Maybe you can just use the SQLite-nio package? As far as I can see, they already enabled the option you want.
Mithesh
(Mithesh)
9
Let me go through the steps I did. I installed SQlite using Swift package manager. Then I imported CSQLite and tried to implement the "sqlite_nio_sqlite3_preupdate_hook()". I got this error.
mrtksn
(Mertol Kasanan)
11
Remove the import SQlite3. If you are going with the SQLite-nio implementation then you will have to use the functions with "sqlite_nio_", so sqlit3_finalize will become sqlite_nio_sqlite3_finalize.
Can you post your Package.swift? Also, how does your "Frameworks, Libraries, and Embedded Content" section look like in the project settings?