dani-sqlite
An amalgamated fork of Irene Knapp's direct-sqlite and Janne Hellsten's sqlite-simple.
-
Unlike direct-sqlite, it doesn't include the code for the C library, so
you'll have to install the library separately.
Example of cabal.project.local pointing to local libs on Windows:
package dani-sqlite
extra-include-dirs: C:/Users/somefolder/sqlite-amalgamation-3350300
extra-lib-dirs: C:/Users/somefolder/sqlite-dll-win64-x64-3350300
-
Requires SQLite >= 3.37.0.
-
Supports sqlite3_open_v2.
-
Supports extended result codes.
-
Unlike sqlite-simple, this library doesn't have a time type.
-
Unlike sqlite-simple, this library doesn't have a quasiquoter.
Links
I see very little reason to not use CApiFFI if your project doesn't need
to work on old GHCs.
-
Writing Haskell interfaces to C code: hsc2hs
-
Using_the_FFI.
-
Haskell/FFI
-
hsctohs
-
Chapter 17. Interfacing with C: the FFI
the #const keyword hsc2hs provides [...] We can bind to the constants manually, by listing the CPP symbols for them using the #const keyword
-
Writing Haskell interfaces to C code: hsc2hs
-
Converting between CInt and Int
Does that mean that I should always use functions like fromIntegral to convert between CInt and Int/Integer?
-
Videos about the Haskell FFI.
-
foreign import capi "wrapper"
While the Report isn't entirely clear on this, but my understanding is that the calling convention (e.g. ccall) in a foreign import ... "wrapper" indicates the calling convention that the resulting FunPtr should expect to be invoked with. If this is true then it's not obvious what foreign import capi "wrapper" should mean; afterall capi isn't really a calling convention. Rather, it just says "delegate code generation for the call to the C compiler". However, we can't delegate like this in for a "wrapper" import, since this would be akin to writing foreign export capi, which don't support.
-
C-language Interface Specification for SQLite
-
parameters
The sqlite3_bind_parameter_name(P,N) interface returns the name of the N-th SQL parameter in the prepared statement P.
Return the index of an SQL parameter given its name. The index value returned is suitable for use as the second parameter to sqlite3_bind().
-
Closing A Database Connection
Ideally, applications should finalize all prepared statements, close all BLOB handles, and finish all sqlite3_backup objects associated with the sqlite3 object prior to attempting to close the object.
Acknowledgements