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_bind_parameter_index,
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_create_function_v2,
CFunc,
CFuncFinal,
CFuncDestroy,
mkCFunc,
mkCFuncFinal,
mkCFuncDestroy,
c_sqlite3_user_data,
c_sqlite3_context_db_handle,
c_sqlite3_aggregate_context,
c_sqlite3_value_type,
c_sqlite3_value_bytes,
c_sqlite3_value_blob,
c_sqlite3_value_text,
c_sqlite3_value_int64,
c_sqlite3_value_double,
c_sqlite3_result_null,
c_sqlite3_result_blob,
c_sqlite3_result_zeroblob,
c_sqlite3_result_text,
c_sqlite3_result_int64,
c_sqlite3_result_double,
c_sqlite3_result_value,
c_sqlite3_result_error,
c_sqlite3_create_collation_v2,
CCompare,
mkCCompare,
c_sqlite3_free,
c_sqlite3_enable_load_extension
) 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_bind_parameter_index"
c_sqlite3_bind_parameter_index :: Ptr CStatement -> CString -> IO CParamIndex
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_create_function_v2"
c_sqlite3_create_function_v2
:: Ptr CDatabase
-> CString
-> CArgCount
-> CInt
-> Ptr a
-> FunPtr CFunc
-> FunPtr CFunc
-> FunPtr CFuncFinal
-> FunPtr (CFuncDestroy a)
-> IO CError
type CFunc = Ptr CContext -> CArgCount -> Ptr (Ptr CValue) -> IO ()
type CFuncFinal = Ptr CContext -> IO ()
type CFuncDestroy a = Ptr a -> IO ()
foreign import ccall "wrapper"
mkCFunc :: CFunc -> IO (FunPtr CFunc)
foreign import ccall "wrapper"
mkCFuncFinal :: CFuncFinal -> IO (FunPtr CFuncFinal)
foreign import ccall "wrapper"
mkCFuncDestroy :: CFuncDestroy a -> IO (FunPtr (CFuncDestroy a))
foreign import ccall unsafe "sqlite3_user_data"
c_sqlite3_user_data :: Ptr CContext -> IO (Ptr a)
foreign import ccall unsafe "sqlite3_context_db_handle"
c_sqlite3_context_db_handle :: Ptr CContext -> IO (Ptr CDatabase)
foreign import ccall unsafe "sqlite3_aggregate_context"
c_sqlite3_aggregate_context :: Ptr CContext -> CNumBytes -> IO (Ptr a)
foreign import ccall unsafe "sqlite3_value_type"
c_sqlite3_value_type :: Ptr CValue -> IO CColumnType
foreign import ccall unsafe "sqlite3_value_bytes"
c_sqlite3_value_bytes :: Ptr CValue -> IO CNumBytes
foreign import ccall unsafe "sqlite3_value_blob"
c_sqlite3_value_blob :: Ptr CValue -> IO (Ptr a)
foreign import ccall unsafe "sqlite3_value_text"
c_sqlite3_value_text :: Ptr CValue -> IO CString
foreign import ccall unsafe "sqlite3_value_int64"
c_sqlite3_value_int64 :: Ptr CValue -> IO Int64
foreign import ccall unsafe "sqlite3_value_double"
c_sqlite3_value_double :: Ptr CValue -> IO Double
foreign import ccall unsafe "sqlite3_result_null"
c_sqlite3_result_null :: Ptr CContext -> IO ()
foreign import ccall unsafe "sqlite3_result_blob"
c_sqlite3_result_blob :: Ptr CContext -> Ptr a -> CNumBytes -> Ptr CDestructor -> IO ()
foreign import ccall unsafe "sqlite3_result_zeroblob"
c_sqlite3_result_zeroblob :: Ptr CContext -> CNumBytes -> IO ()
foreign import ccall unsafe "sqlite3_result_text"
c_sqlite3_result_text :: Ptr CContext -> CString -> CNumBytes -> Ptr CDestructor -> IO ()
foreign import ccall unsafe "sqlite3_result_int64"
c_sqlite3_result_int64 :: Ptr CContext -> Int64 -> IO ()
foreign import ccall unsafe "sqlite3_result_double"
c_sqlite3_result_double :: Ptr CContext -> Double -> IO ()
foreign import ccall unsafe "sqlite3_result_value"
c_sqlite3_result_value :: Ptr CContext -> Ptr CValue -> IO ()
foreign import ccall unsafe "sqlite3_result_error"
c_sqlite3_result_error :: Ptr CContext -> CString -> CNumBytes -> IO ()
foreign import ccall "sqlite3_create_collation_v2"
c_sqlite3_create_collation_v2
:: Ptr CDatabase
-> CString
-> CInt
-> Ptr a
-> FunPtr (CCompare a)
-> FunPtr (CFuncDestroy a)
-> IO CError
type CCompare a = Ptr a -> CNumBytes -> CString -> CNumBytes -> CString -> IO CInt
foreign import ccall "wrapper"
mkCCompare :: CCompare a -> IO (FunPtr (CCompare a))
foreign import ccall "sqlite3_free"
c_sqlite3_free :: Ptr a -> IO ()
foreign import ccall "sqlite3_enable_load_extension"
c_sqlite3_enable_load_extension :: Ptr CDatabase -> Bool -> IO CError