direct-sqlite-2.3.28: Low-level binding to SQLite3. Includes UTF8 and BLOB support.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Database.SQLite3.Bindings

Contents

- 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

Synopsis

- module Database.SQLite3.Bindings.Types
- c_sqlite3_open :: CString -> Ptr (Ptr CDatabase) -> IO CError
- c_sqlite3_open_v2 :: CString -> Ptr (Ptr CDatabase) -> CInt -> CString -> IO CError
- c_sqlite3_close :: Ptr CDatabase -> IO CError
- c_sqlite3_errcode :: Ptr CDatabase -> IO CError
- c_sqlite3_extended_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 :: Bool -> 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_step_unsafe :: 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_free_p :: FunPtr (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

module Database.SQLite3.Bindings.Types

# Connection management

c_sqlite3_open :: CString -> Ptr (Ptr CDatabase) -> IO CError #

https://www.sqlite.org/c3ref/open.html

This sets the `'Ptr CDatabase'` even on failure.

c_sqlite3_open_v2 :: CString -> Ptr (Ptr CDatabase) -> CInt -> CString -> IO CError #

https://www.sqlite.org/c3ref/open.html

This sets the `'Ptr CDatabase'` even on failure.

c_sqlite3_close :: Ptr CDatabase -> IO CError #

https://www.sqlite.org/c3ref/close.html

c_sqlite3_errcode :: Ptr CDatabase -> IO CError #

https://www.sqlite.org/c3ref/errcode.html

c_sqlite3_extended_errcode :: Ptr CDatabase -> IO CError #

https://www.sqlite.org/c3ref/errcode.html

c_sqlite3_errmsg :: Ptr CDatabase -> IO CString #

https://www.sqlite.org/c3ref/errcode.html

c_sqlite3_interrupt :: Ptr CDatabase -> IO () #

https://www.sqlite.org/c3ref/interrupt.html

c_sqlite3_trace #

Arguments

:: Ptr CDatabase |
-> FunPtr (CTraceCallback a) | Optional callback function called for each row.
-> Ptr a | Context passed to the callback.
-> IO (Ptr ()) | Returns context pointer from previously. registered trace.

https://www.sqlite.org/c3ref/profile.html

type CTraceCallback a #

Arguments

= Ptr a |
-> CString | UTF-8 rendering of the SQL statement text as the statement first begins executing.
-> IO () |

mkCTraceCallback :: CTraceCallback a -> IO (FunPtr (CTraceCallback a)) #

c_sqlite3_get_autocommit :: Ptr CDatabase -> IO CInt #

https://www.sqlite.org/c3ref/get_autocommit.html

c_sqlite3_enable_shared_cache :: Bool -> IO CError #

https://www.sqlite.org/c3ref/enable_shared_cache.html

# Simple query execution

https://sqlite.org/c3ref/exec.html

c_sqlite3_exec #

Arguments

:: Ptr CDatabase |
-> CString | SQL statement, UTF-8 encoded.
-> FunPtr (CExecCallback a) | Optional callback function called for each row.
-> Ptr a | Context passed to the callback.
-> Ptr CString | OUT: Error message string.
-> IO CError |

https://www.sqlite.org/c3ref/exec.html

type CExecCallback a #

Arguments

= 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 `c_sqlite3_column_text`. Null values are represented as null pointers.
-> Ptr CString | Array of column names
-> IO CInt | If the callback returns non-zero, then `c_sqlite3_exec` returns `SQLITE_ABORT` (`ErrorAbort`).

mkCExecCallback :: CExecCallback a -> IO (FunPtr (CExecCallback a)) #

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

c_sqlite3_prepare_v2 #

Arguments

:: 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 |

https://www.sqlite.org/c3ref/prepare.html

If the query contains no SQL statements, this returns `SQLITE_OK` and sets the ``Ptr` `CStatement`` to null.

c_sqlite3_db_handle :: Ptr CStatement -> IO (Ptr CDatabase) #

https://www.sqlite.org/c3ref/db_handle.html

c_sqlite3_step :: Ptr CStatement -> IO CError #

https://www.sqlite.org/c3ref/step.html

c_sqlite3_step_unsafe :: Ptr CStatement -> IO CError #

https://www.sqlite.org/c3ref/step.html

c_sqlite3_reset :: Ptr CStatement -> IO CError #

https://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 #

https://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 #

https://www.sqlite.org/c3ref/clear_bindings.html

A look at the source reveals that this function always returns `SQLITE_OK`.

c_sqlite3_sql :: Ptr CStatement -> IO CString #

https://www.sqlite.org/c3ref/sql.html

# Parameter and column information

c_sqlite3_bind_parameter_count :: Ptr CStatement -> IO CParamIndex #

https://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_bind_parameter_name :: Ptr CStatement -> CParamIndex -> IO CString #

https://www.sqlite.org/c3ref/bind_parameter_name.html

c_sqlite3_bind_parameter_index :: Ptr CStatement -> CString -> IO CParamIndex #

https://www.sqlite.org/c3ref/bind_parameter_index.html

c_sqlite3_column_count :: Ptr CStatement -> IO CColumnCount #

https://www.sqlite.org/c3ref/column_count.html

c_sqlite3_column_name :: Ptr CStatement -> CColumnIndex -> IO CString #

https://www.sqlite.org/c3ref/column_name.html

# Binding Values To Prepared Statements

https://www.sqlite.org/c3ref/bind_blob.html

c_sqlite3_bind_blob #

Arguments

:: Ptr CStatement |
-> CParamIndex | Index of the SQL parameter to be set
-> Ptr a | Value to bind to the parameter. Warning: If this pointer is `NULL`, this will bind a null value, rather than an empty blob.
-> CNumBytes | Length, in bytes. This must not be negative.
-> Ptr CDestructor |
-> IO CError |

https://www.sqlite.org/c3ref/bind_blob.html

c_sqlite3_bind_zeroblob :: Ptr CStatement -> CParamIndex -> CInt -> IO CError #

https://www.sqlite.org/c3ref/bind_blob.html

c_sqlite3_bind_text #

Arguments

:: Ptr CStatement |
-> CParamIndex |
-> CString | Warning: If this pointer is `NULL`, this will bind a null value, rather than an empty text.
-> CNumBytes | Length, in bytes. If this is negative, the value is treated as a NUL-terminated string.
-> Ptr CDestructor |
-> IO CError |

https://www.sqlite.org/c3ref/bind_blob.html

c_sqlite3_bind_double :: Ptr CStatement -> CParamIndex -> Double -> IO CError #

https://www.sqlite.org/c3ref/bind_blob.html

c_sqlite3_bind_int64 :: Ptr CStatement -> CParamIndex -> Int64 -> IO CError #

https://www.sqlite.org/c3ref/bind_blob.html

c_sqlite3_bind_null :: Ptr CStatement -> CParamIndex -> IO CError #

https://www.sqlite.org/c3ref/bind_blob.html

# Result Values From A Query

https://www.sqlite.org/c3ref/column_blob.html

c_sqlite3_column_type :: Ptr CStatement -> CColumnIndex -> IO CColumnType #

https://www.sqlite.org/c3ref/column_blob.html

c_sqlite3_column_bytes :: Ptr CStatement -> CColumnIndex -> IO CNumBytes #

https://www.sqlite.org/c3ref/column_blob.html

c_sqlite3_column_blob :: Ptr CStatement -> CColumnIndex -> IO (Ptr a) #

https://www.sqlite.org/c3ref/column_blob.html

c_sqlite3_column_int64 :: Ptr CStatement -> CColumnIndex -> IO Int64 #

https://www.sqlite.org/c3ref/column_blob.html

c_sqlite3_column_double :: Ptr CStatement -> CColumnIndex -> IO Double #

https://www.sqlite.org/c3ref/column_blob.html

c_sqlite3_column_text :: Ptr CStatement -> CColumnIndex -> IO CString #

https://www.sqlite.org/c3ref/column_blob.html

# Result statistics

c_sqlite3_last_insert_rowid :: Ptr CDatabase -> IO Int64 #

https://www.sqlite.org/c3ref/last_insert_rowid.html

c_sqlite3_changes :: Ptr CDatabase -> IO CInt #

https://www.sqlite.org/c3ref/changes.html

c_sqlite3_total_changes :: Ptr CDatabase -> IO CInt #

https://www.sqlite.org/c3ref/total_changes.html

# Create Or Redefine SQL Functions

c_sqlite3_create_function_v2 #

Arguments

:: Ptr CDatabase |
-> CString | Name of the function.
-> CArgCount | Number of arguments.
-> CInt | Preferred text encoding (also used to pass flags).
-> Ptr a | User data.
-> FunPtr CFunc |
-> FunPtr CFunc |
-> FunPtr CFuncFinal |
-> FunPtr (CFuncDestroy a) |
-> IO CError |

https://sqlite.org/c3ref/create_function.html

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) #

https://www.sqlite.org/c3ref/user_data.html

c_sqlite3_context_db_handle :: Ptr CContext -> IO (Ptr CDatabase) #

https://www.sqlite.org/c3ref/context_db_handle.html

c_sqlite3_aggregate_context :: Ptr CContext -> CNumBytes -> IO (Ptr a) #

https://www.sqlite.org/c3ref/aggregate_context.html

# Obtaining SQL Function Parameter Values

https://www.sqlite.org/c3ref/value_blob.html

c_sqlite3_value_type :: Ptr CValue -> IO CColumnType #

https://www.sqlite.org/c3ref/value_blob.html

c_sqlite3_value_bytes :: Ptr CValue -> IO CNumBytes #

https://www.sqlite.org/c3ref/value_blob.html

c_sqlite3_value_blob :: Ptr CValue -> IO (Ptr a) #

https://www.sqlite.org/c3ref/value_blob.html

c_sqlite3_value_text :: Ptr CValue -> IO CString #

https://www.sqlite.org/c3ref/value_blob.html

c_sqlite3_value_int64 :: Ptr CValue -> IO Int64 #

https://www.sqlite.org/c3ref/value_blob.html

c_sqlite3_value_double :: Ptr CValue -> IO Double #

https://www.sqlite.org/c3ref/value_blob.html

# Setting The Result Of An SQL Function

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_null :: Ptr CContext -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_blob :: Ptr CContext -> Ptr a -> CNumBytes -> Ptr CDestructor -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_zeroblob :: Ptr CContext -> CNumBytes -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_text :: Ptr CContext -> CString -> CNumBytes -> Ptr CDestructor -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_int64 :: Ptr CContext -> Int64 -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_double :: Ptr CContext -> Double -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_value :: Ptr CContext -> Ptr CValue -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

c_sqlite3_result_error :: Ptr CContext -> CString -> CNumBytes -> IO () #

https://www.sqlite.org/c3ref/result_blob.html

# Define New Collating Sequences

c_sqlite3_create_collation_v2 #

Arguments

:: Ptr CDatabase |
-> CString | Name of the collation.
-> CInt | Text encoding.
-> Ptr a | User data.
-> FunPtr (CCompare a) |
-> FunPtr (CFuncDestroy a) |
-> IO CError |

https://www.sqlite.org/c3ref/create_collation.html

type CCompare a = Ptr a -> CNumBytes -> CString -> CNumBytes -> CString -> IO CInt #

mkCCompare :: CCompare a -> IO (FunPtr (CCompare a)) #

# Miscellaneous

c_sqlite3_free :: Ptr a -> IO () #

https://sqlite.org/c3ref/free.html

c_sqlite3_free_p :: FunPtr (Ptr a -> IO ()) #

https://sqlite.org/c3ref/free.html

# Extensions

c_sqlite3_enable_load_extension :: Ptr CDatabase -> Bool -> IO CError #

https://sqlite.org/c3ref/enable_load_extension.html

# Write-Ahead Log Commit Hook

c_sqlite3_wal_hook :: Ptr CDatabase -> FunPtr CWalHook -> Ptr a -> IO (Ptr ()) #

https://www.sqlite.org/c3ref/wal_hook.html

type CWalHook = Ptr () -> Ptr CDatabase -> CString -> CInt -> IO CError #

mkCWalHook :: CWalHook -> IO (FunPtr CWalHook) #

# Incremental blob I/O

c_sqlite3_blob_open #

Arguments

:: Ptr CDatabase |
-> CString | Database name.
-> CString | Table name.
-> CString | Column name.
-> Int64 | Row ROWID.
-> CInt | Flags.
-> Ptr (Ptr CBlob) | OUT: Blob handle, will be NULL on error.
-> IO CError |

https://www.sqlite.org/c3ref/blob_open.html

c_sqlite3_blob_close :: Ptr CBlob -> IO CError #

https://www.sqlite.org/c3ref/blob_close.html

c_sqlite3_blob_reopen :: Ptr CBlob -> Int64 -> IO CError #

https://www.sqlite.org/c3ref/blob_reopen.html

c_sqlite3_blob_bytes :: Ptr CBlob -> IO CInt #

https://www.sqlite.org/c3ref/blob_bytes.html

c_sqlite3_blob_read :: Ptr CBlob -> Ptr a -> CInt -> CInt -> IO CError #

https://www.sqlite.org/c3ref/blob_read.html

c_sqlite3_blob_write :: Ptr CBlob -> Ptr a -> CInt -> CInt -> IO CError #

https://www.sqlite.org/c3ref/blob_write.html

# Online Backup API

https://www.sqlite.org/backup.html and https://www.sqlite.org/c3ref/backup_finish.html

c_sqlite3_backup_init #

Arguments

:: Ptr CDatabase | Destination database handle.
-> CString | Destination database name.
-> Ptr CDatabase | Source database handle.
-> CString | Source database name.
-> IO (Ptr CBackup) |

https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupinit

c_sqlite3_backup_finish :: Ptr CBackup -> IO CError #

https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish

c_sqlite3_backup_step :: Ptr CBackup -> CInt -> IO CError #

https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep

c_sqlite3_backup_remaining :: Ptr CBackup -> IO CInt #

https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupremaining

c_sqlite3_backup_pagecount :: Ptr CBackup -> IO CInt #

https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backuppagecount