module Database.SQLite3.Bindings (
module Database.SQLite3.Bindings.Types,
c_sqlite3_open,
c_sqlite3_close,
c_sqlite3_errmsg,
c_sqlite3_interrupt,
c_sqlite3_trace,
CTraceCallback,
mkCTraceCallback,
c_sqlite3_get_autocommit,
c_sqlite3_exec,
CExecCallback,
mkCExecCallback,
c_sqlite3_prepare_v2,
c_sqlite3_db_handle,
c_sqlite3_step,
c_sqlite3_reset,
c_sqlite3_finalize,
c_sqlite3_clear_bindings,
c_sqlite3_sql,
c_sqlite3_bind_parameter_count,
c_sqlite3_bind_parameter_name,
c_sqlite3_column_count,
c_sqlite3_column_name,
c_sqlite3_bind_blob,
c_sqlite3_bind_text,
c_sqlite3_bind_double,
c_sqlite3_bind_int64,
c_sqlite3_bind_null,
c_sqlite3_column_type,
c_sqlite3_column_bytes,
c_sqlite3_column_blob,
c_sqlite3_column_int64,
c_sqlite3_column_double,
c_sqlite3_column_text,
c_sqlite3_last_insert_rowid,
c_sqlite3_changes,
c_sqlite3_total_changes,
c_sqlite3_free,
) where
import Database.SQLite3.Bindings.Types
import Foreign
import Foreign.C
foreign import ccall "sqlite3_open"
c_sqlite3_open :: CString -> Ptr (Ptr CDatabase) -> IO CError
foreign import ccall "sqlite3_close"
c_sqlite3_close :: Ptr CDatabase -> IO CError
foreign import ccall "sqlite3_errmsg"
c_sqlite3_errmsg :: Ptr CDatabase -> IO CString
foreign import ccall "sqlite3_interrupt"
c_sqlite3_interrupt :: Ptr CDatabase -> IO ()
foreign import ccall "sqlite3_trace"
c_sqlite3_trace
:: Ptr CDatabase
-> FunPtr (CTraceCallback a)
-> Ptr a
-> IO (Ptr ())
foreign import ccall unsafe "sqlite3_get_autocommit"
c_sqlite3_get_autocommit :: Ptr CDatabase -> IO CInt
foreign import ccall "sqlite3_exec"
c_sqlite3_exec
:: Ptr CDatabase
-> CString
-> FunPtr (CExecCallback a)
-> Ptr a
-> Ptr CString
-> IO CError
type CExecCallback a
= Ptr a
-> CColumnCount
-> Ptr CString
-> Ptr CString
-> IO CInt
type CTraceCallback a
= Ptr a
-> CString
-> IO ()
foreign import ccall "wrapper"
mkCExecCallback :: CExecCallback a -> IO (FunPtr (CExecCallback a))
foreign import ccall "wrapper"
mkCTraceCallback :: CTraceCallback a -> IO (FunPtr (CTraceCallback a))
foreign import ccall "sqlite3_prepare_v2"
c_sqlite3_prepare_v2
:: Ptr CDatabase
-> CString
-> CNumBytes
-> Ptr (Ptr CStatement)
-> Ptr CString
-> IO CError
foreign import ccall unsafe "sqlite3_db_handle"
c_sqlite3_db_handle :: Ptr CStatement -> IO (Ptr CDatabase)
foreign import ccall "sqlite3_step"
c_sqlite3_step :: Ptr CStatement -> IO CError
foreign import ccall "sqlite3_reset"
c_sqlite3_reset :: Ptr CStatement -> IO CError
foreign import ccall "sqlite3_finalize"
c_sqlite3_finalize :: Ptr CStatement -> IO CError
foreign import ccall unsafe "sqlite3_clear_bindings"
c_sqlite3_clear_bindings :: Ptr CStatement -> IO CError
foreign import ccall unsafe "sqlite3_sql"
c_sqlite3_sql :: Ptr CStatement -> IO CString
foreign import ccall unsafe "sqlite3_bind_parameter_count"
c_sqlite3_bind_parameter_count :: Ptr CStatement -> IO CParamIndex
foreign import ccall unsafe "sqlite3_bind_parameter_name"
c_sqlite3_bind_parameter_name :: Ptr CStatement -> CParamIndex -> IO CString
foreign import ccall unsafe "sqlite3_column_count"
c_sqlite3_column_count :: Ptr CStatement -> IO CColumnCount
foreign import ccall unsafe "sqlite3_column_name"
c_sqlite3_column_name :: Ptr CStatement -> CColumnIndex -> IO CString
foreign import ccall unsafe "sqlite3_bind_blob"
c_sqlite3_bind_blob
:: Ptr CStatement
-> CParamIndex
-> Ptr a
-> CNumBytes
-> Ptr CDestructor
-> IO CError
foreign import ccall unsafe "sqlite3_bind_text"
c_sqlite3_bind_text
:: Ptr CStatement
-> CParamIndex
-> CString
-> CNumBytes
-> Ptr CDestructor
-> IO CError
foreign import ccall unsafe "sqlite3_bind_double"
c_sqlite3_bind_double :: Ptr CStatement -> CParamIndex -> Double -> IO CError
foreign import ccall unsafe "sqlite3_bind_int64"
c_sqlite3_bind_int64 :: Ptr CStatement -> CParamIndex -> Int64 -> IO CError
foreign import ccall unsafe "sqlite3_bind_null"
c_sqlite3_bind_null :: Ptr CStatement -> CParamIndex -> IO CError
foreign import ccall unsafe "sqlite3_column_type"
c_sqlite3_column_type :: Ptr CStatement -> CColumnIndex -> IO CColumnType
foreign import ccall unsafe "sqlite3_column_bytes"
c_sqlite3_column_bytes :: Ptr CStatement -> CColumnIndex -> IO CNumBytes
foreign import ccall unsafe "sqlite3_column_blob"
c_sqlite3_column_blob :: Ptr CStatement -> CColumnIndex -> IO (Ptr a)
foreign import ccall unsafe "sqlite3_column_text"
c_sqlite3_column_text :: Ptr CStatement -> CColumnIndex -> IO CString
foreign import ccall unsafe "sqlite3_column_int64"
c_sqlite3_column_int64 :: Ptr CStatement -> CColumnIndex -> IO Int64
foreign import ccall unsafe "sqlite3_column_double"
c_sqlite3_column_double :: Ptr CStatement -> CColumnIndex -> IO Double
foreign import ccall unsafe "sqlite3_last_insert_rowid"
c_sqlite3_last_insert_rowid :: Ptr CDatabase -> IO Int64
foreign import ccall unsafe "sqlite3_changes"
c_sqlite3_changes :: Ptr CDatabase -> IO CInt
foreign import ccall unsafe "sqlite3_total_changes"
c_sqlite3_total_changes :: Ptr CDatabase -> IO CInt
foreign import ccall "sqlite3_free"
c_sqlite3_free :: Ptr a -> IO ()