Safe Haskell | None |
---|---|
Language | Haskell2010 |
- Connection management
- Simple query execution
- Statement management
- Parameter and column information
- Binding Values To Prepared Statements
- Result Values From A Query
- Result statistics
- Create Or Redefine SQL Functions
- Obtaining SQL Function Parameter Values
- Setting The Result Of An SQL Function
- Define New Collating Sequences
- Miscellaneous
- Extensions
- Write-Ahead Log Commit Hook
- Incremental blob I/O
- Online Backup API
- module Database.SQLite3.Bindings.Types
- c_sqlite3_open :: CString -> Ptr (Ptr CDatabase) -> IO CError
- c_sqlite3_close :: Ptr CDatabase -> IO CError
- c_sqlite3_errcode :: Ptr CDatabase -> IO CError
- c_sqlite3_errmsg :: Ptr CDatabase -> IO CString
- c_sqlite3_interrupt :: Ptr CDatabase -> IO ()
- c_sqlite3_trace :: Ptr CDatabase -> FunPtr (CTraceCallback a) -> Ptr a -> IO (Ptr ())
- type CTraceCallback a = Ptr a -> CString -> IO ()
- mkCTraceCallback :: CTraceCallback a -> IO (FunPtr (CTraceCallback a))
- c_sqlite3_get_autocommit :: Ptr CDatabase -> IO CInt
- c_sqlite3_enable_shared_cache :: CInt -> IO CError
- 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
- mkCExecCallback :: CExecCallback a -> IO (FunPtr (CExecCallback a))
- c_sqlite3_prepare_v2 :: Ptr CDatabase -> CString -> CNumBytes -> Ptr (Ptr CStatement) -> Ptr CString -> IO CError
- c_sqlite3_db_handle :: Ptr CStatement -> IO (Ptr CDatabase)
- c_sqlite3_step :: Ptr CStatement -> IO CError
- c_sqlite3_reset :: Ptr CStatement -> IO CError
- c_sqlite3_finalize :: Ptr CStatement -> IO CError
- c_sqlite3_clear_bindings :: Ptr CStatement -> IO CError
- c_sqlite3_sql :: Ptr CStatement -> IO CString
- c_sqlite3_bind_parameter_count :: Ptr CStatement -> IO CParamIndex
- c_sqlite3_bind_parameter_name :: Ptr CStatement -> CParamIndex -> IO CString
- c_sqlite3_bind_parameter_index :: Ptr CStatement -> CString -> IO CParamIndex
- c_sqlite3_column_count :: Ptr CStatement -> IO CColumnCount
- c_sqlite3_column_name :: Ptr CStatement -> CColumnIndex -> IO CString
- c_sqlite3_bind_blob :: Ptr CStatement -> CParamIndex -> Ptr a -> CNumBytes -> Ptr CDestructor -> IO CError
- c_sqlite3_bind_zeroblob :: Ptr CStatement -> CParamIndex -> CInt -> IO CError
- c_sqlite3_bind_text :: Ptr CStatement -> CParamIndex -> CString -> CNumBytes -> Ptr CDestructor -> IO CError
- c_sqlite3_bind_double :: Ptr CStatement -> CParamIndex -> Double -> IO CError
- c_sqlite3_bind_int64 :: Ptr CStatement -> CParamIndex -> Int64 -> IO CError
- c_sqlite3_bind_null :: Ptr CStatement -> CParamIndex -> IO CError
- c_sqlite3_column_type :: Ptr CStatement -> CColumnIndex -> IO CColumnType
- c_sqlite3_column_bytes :: Ptr CStatement -> CColumnIndex -> IO CNumBytes
- c_sqlite3_column_blob :: Ptr CStatement -> CColumnIndex -> IO (Ptr a)
- c_sqlite3_column_int64 :: Ptr CStatement -> CColumnIndex -> IO Int64
- c_sqlite3_column_double :: Ptr CStatement -> CColumnIndex -> IO Double
- c_sqlite3_column_text :: Ptr CStatement -> CColumnIndex -> IO CString
- c_sqlite3_last_insert_rowid :: Ptr CDatabase -> IO Int64
- c_sqlite3_changes :: Ptr CDatabase -> IO CInt
- c_sqlite3_total_changes :: Ptr CDatabase -> IO CInt
- 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 ()
- mkCFunc :: CFunc -> IO (FunPtr CFunc)
- mkCFuncFinal :: CFuncFinal -> IO (FunPtr CFuncFinal)
- mkCFuncDestroy :: CFuncDestroy a -> IO (FunPtr (CFuncDestroy a))
- c_sqlite3_user_data :: Ptr CContext -> IO (Ptr a)
- c_sqlite3_context_db_handle :: Ptr CContext -> IO (Ptr CDatabase)
- c_sqlite3_aggregate_context :: Ptr CContext -> CNumBytes -> IO (Ptr a)
- c_sqlite3_value_type :: Ptr CValue -> IO CColumnType
- c_sqlite3_value_bytes :: Ptr CValue -> IO CNumBytes
- c_sqlite3_value_blob :: Ptr CValue -> IO (Ptr a)
- c_sqlite3_value_text :: Ptr CValue -> IO CString
- c_sqlite3_value_int64 :: Ptr CValue -> IO Int64
- c_sqlite3_value_double :: Ptr CValue -> IO Double
- c_sqlite3_result_null :: Ptr CContext -> IO ()
- c_sqlite3_result_blob :: Ptr CContext -> Ptr a -> CNumBytes -> Ptr CDestructor -> IO ()
- c_sqlite3_result_zeroblob :: Ptr CContext -> CNumBytes -> IO ()
- c_sqlite3_result_text :: Ptr CContext -> CString -> CNumBytes -> Ptr CDestructor -> IO ()
- c_sqlite3_result_int64 :: Ptr CContext -> Int64 -> IO ()
- c_sqlite3_result_double :: Ptr CContext -> Double -> IO ()
- c_sqlite3_result_value :: Ptr CContext -> Ptr CValue -> IO ()
- c_sqlite3_result_error :: Ptr CContext -> CString -> CNumBytes -> IO ()
- 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
- mkCCompare :: CCompare a -> IO (FunPtr (CCompare a))
- c_sqlite3_free :: Ptr a -> IO ()
- c_sqlite3_enable_load_extension :: Ptr CDatabase -> Bool -> IO CError
- c_sqlite3_wal_hook :: Ptr CDatabase -> FunPtr CWalHook -> Ptr a -> IO (Ptr ())
- type CWalHook = Ptr () -> Ptr CDatabase -> CString -> CInt -> IO CError
- mkCWalHook :: CWalHook -> IO (FunPtr CWalHook)
- c_sqlite3_blob_open :: Ptr CDatabase -> CString -> CString -> CString -> Int64 -> CInt -> Ptr (Ptr CBlob) -> IO CError
- c_sqlite3_blob_close :: Ptr CBlob -> IO CError
- c_sqlite3_blob_reopen :: Ptr CBlob -> Int64 -> IO CError
- c_sqlite3_blob_bytes :: Ptr CBlob -> IO CInt
- c_sqlite3_blob_read :: Ptr CBlob -> Ptr a -> CInt -> CInt -> IO CError
- c_sqlite3_blob_write :: Ptr CBlob -> Ptr a -> CInt -> CInt -> IO CError
- c_sqlite3_backup_init :: Ptr CDatabase -> CString -> Ptr CDatabase -> CString -> IO (Ptr CBackup)
- c_sqlite3_backup_finish :: Ptr CBackup -> IO CError
- c_sqlite3_backup_step :: Ptr CBackup -> CInt -> IO CError
- c_sqlite3_backup_remaining :: Ptr CBackup -> IO CInt
- c_sqlite3_backup_pagecount :: Ptr CBackup -> IO CInt
Documentation
Connection management
c_sqlite3_open :: CString -> Ptr (Ptr CDatabase) -> IO CError Source #
http://www.sqlite.org/c3ref/open.html
This sets the 'Ptr CDatabase'
even on failure.
type CTraceCallback a Source #
mkCTraceCallback :: CTraceCallback a -> IO (FunPtr (CTraceCallback a)) Source #
Simple query execution
type CExecCallback a Source #
= Ptr a | |
-> CColumnCount | Number of columns, which is the number of elements in the following arrays. |
-> Ptr CString | Array of column values, as returned by
|
-> Ptr CString | Array of column names |
-> IO CInt | If the callback returns non-zero, then
|
mkCExecCallback :: CExecCallback a -> IO (FunPtr (CExecCallback a)) Source #
A couple important things to know about callbacks from Haskell code:
- If the callback throws an exception, apparently, the whole program is terminated.
- Remember to call
freeHaskellFunPtr
when you are done with the wrapper, to avoid leaking memory.
Statement management
:: Ptr CDatabase | |
-> CString | SQL statement, UTF-8 encoded |
-> CNumBytes | Maximum length of the SQL statement, in bytes. If this is negative, then the SQL statement is treated as a NUL-terminated string. |
-> Ptr (Ptr CStatement) | OUT: Statement handle. This must not be null. |
-> Ptr CString | OUT: Pointer to unused portion of zSql |
-> IO CError |
http://www.sqlite.org/c3ref/prepare.html
If the query contains no SQL statements, this returns SQLITE_OK
and sets
the
to null.Ptr
CStatement
c_sqlite3_db_handle :: Ptr CStatement -> IO (Ptr CDatabase) Source #
c_sqlite3_reset :: Ptr CStatement -> IO CError Source #
http://www.sqlite.org/c3ref/reset.html
Warning: If the most recent c_sqlite3_step
call failed,
this will return the corresponding error code.
c_sqlite3_finalize :: Ptr CStatement -> IO CError Source #
http://www.sqlite.org/c3ref/finalize.html
Warning: If the most recent c_sqlite3_step
call failed,
this will return the corresponding error code.
c_sqlite3_clear_bindings :: Ptr CStatement -> IO CError Source #
http://www.sqlite.org/c3ref/clear_bindings.html
A look at the source reveals that this function always returns SQLITE_OK
.
Parameter and column information
c_sqlite3_bind_parameter_count :: Ptr CStatement -> IO CParamIndex Source #
http://www.sqlite.org/c3ref/bind_parameter_count.html
This returns the index of the largest (rightmost) parameter, which is not
necessarily the number of parameters. If numbered parameters like ?5
are used, there may be gaps in the list.
c_sqlite3_column_name :: Ptr CStatement -> CColumnIndex -> IO CString Source #
Binding Values To Prepared Statements
:: Ptr CStatement | |
-> CParamIndex | Index of the SQL parameter to be set |
-> Ptr a | Value to bind to the parameter. Warning: If this pointer is |
-> CNumBytes | Length, in bytes. This must not be negative. |
-> Ptr CDestructor | |
-> IO CError |
c_sqlite3_bind_zeroblob :: Ptr CStatement -> CParamIndex -> CInt -> IO CError Source #
:: Ptr CStatement | |
-> CParamIndex | |
-> CString | Warning: If this pointer is |
-> CNumBytes | Length, in bytes. If this is negative, the value is treated as a NUL-terminated string. |
-> Ptr CDestructor | |
-> IO CError |
c_sqlite3_bind_double :: Ptr CStatement -> CParamIndex -> Double -> IO CError Source #
c_sqlite3_bind_int64 :: Ptr CStatement -> CParamIndex -> Int64 -> IO CError Source #
c_sqlite3_bind_null :: Ptr CStatement -> CParamIndex -> IO CError Source #
Result Values From A Query
c_sqlite3_column_blob :: Ptr CStatement -> CColumnIndex -> IO (Ptr a) Source #
c_sqlite3_column_int64 :: Ptr CStatement -> CColumnIndex -> IO Int64 Source #
c_sqlite3_column_double :: Ptr CStatement -> CColumnIndex -> IO Double Source #
c_sqlite3_column_text :: Ptr CStatement -> CColumnIndex -> IO CString Source #
Result statistics
Create Or Redefine SQL Functions
type CFuncDestroy a = Ptr a -> IO () Source #
mkCFuncFinal :: CFuncFinal -> IO (FunPtr CFuncFinal) Source #
mkCFuncDestroy :: CFuncDestroy a -> IO (FunPtr (CFuncDestroy a)) Source #
Obtaining SQL Function Parameter Values
Setting The Result Of An SQL Function
c_sqlite3_result_blob :: Ptr CContext -> Ptr a -> CNumBytes -> Ptr CDestructor -> IO () Source #
c_sqlite3_result_text :: Ptr CContext -> CString -> CNumBytes -> Ptr CDestructor -> IO () Source #
Define New Collating Sequences
Miscellaneous
c_sqlite3_free :: Ptr a -> IO () Source #