Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Database.SQLite3
Contents
Synopsis
- open :: Text -> IO Database
- open2 :: Text -> [SQLOpenFlag] -> SQLVFS -> IO Database
- close :: Database -> IO ()
- exec :: Database -> Text -> IO ()
- execPrint :: Database -> Text -> IO ()
- execWithCallback :: Database -> Text -> ExecCallback -> IO ()
- type ExecCallback = ColumnCount -> [Text] -> [Maybe Text] -> IO ()
- prepare :: Database -> Text -> IO Statement
- prepareUtf8 :: Database -> Utf8 -> IO Statement
- step :: Statement -> IO StepResult
- stepNoCB :: Statement -> IO StepResult
- reset :: Statement -> IO ()
- finalize :: Statement -> IO ()
- clearBindings :: Statement -> IO ()
- bindParameterCount :: Statement -> IO ParamIndex
- bindParameterName :: Statement -> ParamIndex -> IO (Maybe Text)
- columnCount :: Statement -> IO ColumnCount
- columnName :: Statement -> ColumnIndex -> IO (Maybe Text)
- bindSQLData :: Statement -> ParamIndex -> SQLData -> IO ()
- bind :: Statement -> [SQLData] -> IO ()
- bindNamed :: Statement -> [(Text, SQLData)] -> IO ()
- bindInt :: Statement -> ParamIndex -> Int -> IO ()
- bindInt64 :: Statement -> ParamIndex -> Int64 -> IO ()
- bindDouble :: Statement -> ParamIndex -> Double -> IO ()
- bindText :: Statement -> ParamIndex -> Text -> IO ()
- bindBlob :: Statement -> ParamIndex -> ByteString -> IO ()
- bindZeroBlob :: Statement -> ParamIndex -> Int -> IO ()
- bindNull :: Statement -> ParamIndex -> IO ()
- column :: Statement -> ColumnIndex -> IO SQLData
- columns :: Statement -> IO [SQLData]
- typedColumns :: Statement -> [Maybe ColumnType] -> IO [SQLData]
- columnType :: Statement -> ColumnIndex -> IO ColumnType
- columnInt64 :: Statement -> ColumnIndex -> IO Int64
- columnDouble :: Statement -> ColumnIndex -> IO Double
- columnText :: Statement -> ColumnIndex -> IO Text
- columnBlob :: Statement -> ColumnIndex -> IO ByteString
- lastInsertRowId :: Database -> IO Int64
- changes :: Database -> IO Int
- createFunction :: Database -> Text -> Maybe ArgCount -> Bool -> (FuncContext -> FuncArgs -> IO ()) -> IO ()
- createAggregate :: Database -> Text -> Maybe ArgCount -> a -> (FuncContext -> FuncArgs -> a -> IO a) -> (FuncContext -> a -> IO ()) -> IO ()
- deleteFunction :: Database -> Text -> Maybe ArgCount -> IO ()
- funcArgCount :: FuncArgs -> ArgCount
- funcArgType :: FuncArgs -> ArgIndex -> IO ColumnType
- funcArgInt64 :: FuncArgs -> ArgIndex -> IO Int64
- funcArgDouble :: FuncArgs -> ArgIndex -> IO Double
- funcArgText :: FuncArgs -> ArgIndex -> IO Text
- funcArgBlob :: FuncArgs -> ArgIndex -> IO ByteString
- funcResultSQLData :: FuncContext -> SQLData -> IO ()
- funcResultInt64 :: FuncContext -> Int64 -> IO ()
- funcResultDouble :: FuncContext -> Double -> IO ()
- funcResultText :: FuncContext -> Text -> IO ()
- funcResultBlob :: FuncContext -> ByteString -> IO ()
- funcResultZeroBlob :: FuncContext -> Int -> IO ()
- funcResultNull :: FuncContext -> IO ()
- getFuncContextDatabase :: FuncContext -> IO Database
- createCollation :: Database -> Text -> (Text -> Text -> Ordering) -> IO ()
- deleteCollation :: Database -> Text -> IO ()
- interrupt :: Database -> IO ()
- interruptibly :: Database -> IO a -> IO a
- blobOpen :: Database -> Text -> Text -> Text -> Int64 -> Bool -> IO Blob
- blobClose :: Blob -> IO ()
- blobReopen :: Blob -> Int64 -> IO ()
- blobBytes :: Blob -> IO Int
- blobRead :: Blob -> Int -> Int -> IO ByteString
- blobReadBuf :: Blob -> Ptr a -> Int -> Int -> IO ()
- blobWrite :: Blob -> ByteString -> Int -> IO ()
- backupInit :: Database -> Text -> Database -> Text -> IO Backup
- backupFinish :: Backup -> IO ()
- backupStep :: Backup -> Int -> IO BackupStepResult
- backupRemaining :: Backup -> IO Int
- backupPagecount :: Backup -> IO Int
- data Database
- data Statement
- data SQLData
- = SQLInteger !Int64
- | SQLFloat !Double
- | SQLText !Text
- | SQLBlob !ByteString
- | SQLNull
- data SQLOpenFlag
- = SQLOpenReadOnly
- | SQLOpenReadWrite
- | SQLOpenCreate
- | SQLOpenDeleteOnClose
- | SQLOpenExclusive
- | SQLOpenAutoProxy
- | SQLOpenURI
- | SQLOpenMemory
- | SQLOpenMainDB
- | SQLOpenTempDB
- | SQLOpenTransientDB
- | SQLOpenMainJournal
- | SQLOpenTempJournal
- | SQLOpenSubJournal
- | SQLOpenMasterJournal
- | SQLOpenNoMutex
- | SQLOpenFullMutex
- | SQLOpenSharedCache
- | SQLOpenPrivateCache
- | SQLOpenWAL
- | SQLOpenNoFollow
- data SQLVFS
- data SQLError = SQLError {
- sqlError :: !Error
- sqlErrorDetails :: Text
- sqlErrorContext :: Text
- data ColumnType
- data FuncContext
- data FuncArgs
- data Blob
- data Backup
- data StepResult
- data BackupStepResult
- data Error
- = ErrorOK
- | ErrorError
- | ErrorInternal
- | ErrorPermission
- | ErrorAbort
- | ErrorBusy
- | ErrorLocked
- | ErrorNoMemory
- | ErrorReadOnly
- | ErrorInterrupt
- | ErrorIO
- | ErrorCorrupt
- | ErrorNotFound
- | ErrorFull
- | ErrorCan'tOpen
- | ErrorProtocol
- | ErrorEmpty
- | ErrorSchema
- | ErrorTooBig
- | ErrorConstraint
- | ErrorMismatch
- | ErrorMisuse
- | ErrorNoLargeFileSupport
- | ErrorAuthorization
- | ErrorFormat
- | ErrorRange
- | ErrorNotADatabase
- | ErrorNotice
- | ErrorWarning
- | ErrorRow
- | ErrorDone
- | ErrorErrorMissingCollatingSquence
- | ErrorErrorRetry
- | ErrorErrorSnapshot
- | ErrorIORead
- | ErrorIOShortRead
- | ErrorIOWrite
- | ErrorIOFsync
- | ErrorIODirectoryFsync
- | ErrorIOTruncate
- | ErrorIOFstat
- | ErrorIOUnlock
- | ErrorIOReadLock
- | ErrorIOBlocked
- | ErrorIODelete
- | ErrorIONoMemory
- | ErrorIOAccess
- | ErrorIOCheckReservedLock
- | ErrorIOLock
- | ErrorIOClose
- | ErrorIODirectoryClose
- | ErrorIOShmOpen
- | ErrorIOShmSize
- | ErrorIOShmLock
- | ErrorIOShmMap
- | ErrorIOSeek
- | ErrorIODeleteNoEntity
- | ErrorIOMmap
- | ErrorIOGetTempPath
- | ErrorIOConvertedPath
- | ErrorIOVNode
- | ErrorIOAuth
- | ErrorIOBeginAtomic
- | ErrorIOCommitAtomic
- | ErrorIORollbackAtomic
- | ErrorIOData
- | ErrorIOCorruptFilesystem
- | ErrorLockedSharedCache
- | ErrorLockedVirtualTable
- | ErrorBusyRecovery
- | ErrorBusySnapshot
- | ErrorBusyTimeout
- | ErrorCan'tOpenNotTempDirectory
- | ErrorCan'tOpenIsDirectory
- | ErrorCan'tOpenFullPath
- | ErrorCan'tOpenConvertedPath
- | ErrorCan'tOpenDirtyWriteAheadLog
- | ErrorCan'tOpenSymlink
- | ErrorCorruptVirtualTable
- | ErrorCorruptSequence
- | ErrorCorruptIndex
- | ErrorReadOnlyRecovery
- | ErrorReadOnlyCan'tLock
- | ErrorReadOnlyRollback
- | ErrorReadOnlyDatabaseMoved
- | ErrorReadOnlyCan'tInit
- | ErrorReadOnlyDirectory
- | ErrorAbortRollback
- | ErrorConstraintCheck
- | ErrorConstraintCommitHook
- | ErrorConstraintForeignKey
- | ErrorConstraintFunction
- | ErrorConstraintNotNull
- | ErrorConstraintPrimaryKey
- | ErrorConstraintTrigger
- | ErrorConstraintUnique
- | ErrorConstraintVirtualTable
- | ErrorConstraintRowId
- | ErrorConstraintPinned
- | ErrorConstraintDataType
- | ErrorNoticeRecoverWriteAheadLog
- | ErrorNoticeRecoverRollback
- | ErrorWarningAutoIndex
- | ErrorAuthUser
- | ErrorOkLoadPermanently
- newtype ParamIndex = ParamIndex Int
- newtype ColumnIndex = ColumnIndex Int
- type ColumnCount = ColumnIndex
- newtype ArgCount = ArgCount Int
- type ArgIndex = ArgCount
Connection management
open2 :: Text -> [SQLOpenFlag] -> SQLVFS -> IO Database #
Simple query execution
execWithCallback :: Database -> Text -> ExecCallback -> IO () #
Like exec
, but invoke the callback for each result row.
type ExecCallback #
Arguments
= ColumnCount | Number of columns, which is the number of items in the following lists. This will be the same for every row. |
-> [Text] | List of column names. This will be the same for every row. |
-> [Maybe Text] | List of column values, as returned by |
-> IO () |
Statement management
prepare :: Database -> Text -> IO Statement #
https://www.sqlite.org/c3ref/prepare.html
Unlike exec
, prepare
only executes the first statement, and ignores
subsequent statements.
If the query string contains no SQL statements, this fail
s.
prepareUtf8 :: Database -> Utf8 -> IO Statement #
https://www.sqlite.org/c3ref/prepare.html
It can help to avoid redundant Utf8 to Text conversion if you already have Utf8
If the query string contains no SQL statements, this fail
s.
stepNoCB :: Statement -> IO StepResult #
https://www.sqlite.org/c3ref/step.html
Faster step for statements that don't callback to Haskell functions (e.g. by using custom SQL functions).
https://www.sqlite.org/c3ref/reset.html
Note that in the C API, sqlite3_reset
returns an error code if the most
recent sqlite3_step
indicated an error. We do not replicate that behavior
here. reset
never throws an exception.
clearBindings :: Statement -> IO () #
https://www.sqlite.org/c3ref/clear_bindings.html
Set all parameters in the prepared statement to null.
Parameter and column information
bindParameterCount :: Statement -> IO ParamIndex #
https://www.sqlite.org/c3ref/bind_parameter_count.html
This returns the index of the largest (rightmost) parameter. Note that this
is not necessarily the number of parameters. If numbered parameters like
?5
are used, there may be gaps in the list.
See ParamIndex
for more information.
bindParameterName :: Statement -> ParamIndex -> IO (Maybe Text) #
https://www.sqlite.org/c3ref/bind_parameter_name.html
Return the N-th SQL parameter name.
Named parameters are returned as-is. E.g. ":v" is returned as
Just ":v"
. Unnamed parameters, however, are converted to
Nothing
.
Note that the parameter index starts at 1, not 0.
columnName :: Statement -> ColumnIndex -> IO (Maybe Text) #
https://www.sqlite.org/c3ref/column_name.html
Return the name of a result column. If the column index is out of range,
return Nothing
.
Binding values to a prepared statement
bindSQLData :: Statement -> ParamIndex -> SQLData -> IO () #
If the index is not between 1 and bindParameterCount
inclusive, this
fails with ErrorRange
. Otherwise, it succeeds, even if the query skips
this index by using numbered parameters.
Example:
> stmt <- prepare conn "SELECT ?1, ?3, ?5" > bindSQLData stmt 1 (SQLInteger 1) > bindSQLData stmt 2 (SQLInteger 2) > bindSQLData stmt 6 (SQLInteger 6) *** Exception: SQLite3 returned ErrorRange while attempting to perform bind int64. > step stmt >> columns stmt [SQLInteger 1,SQLNull,SQLNull]
bind :: Statement -> [SQLData] -> IO () #
Convenience function for binding values to all parameters. This will
fail
if the list has the wrong number of parameters.
bindNamed :: Statement -> [(Text, SQLData)] -> IO () #
Convenience function for binding named values to all parameters.
This will fail
if the list has the wrong number of parameters or
if an unknown name is used.
Example:
stmt <- prepare conn "SELECT :foo + :bar" bindNamed stmt [(":foo", SQLInteger 1), (":bar", SQLInteger 2)]
bindInt :: Statement -> ParamIndex -> Int -> IO () #
bindInt64 :: Statement -> ParamIndex -> Int64 -> IO () #
bindDouble :: Statement -> ParamIndex -> Double -> IO () #
bindText :: Statement -> ParamIndex -> Text -> IO () #
bindBlob :: Statement -> ParamIndex -> ByteString -> IO () #
bindZeroBlob :: Statement -> ParamIndex -> Int -> IO () #
bindNull :: Statement -> ParamIndex -> IO () #
Reading the result row
https://www.sqlite.org/c3ref/column_blob.html
Warning: column
and columns
will throw a DecodeError
if any TEXT
datum contains invalid UTF-8.
column :: Statement -> ColumnIndex -> IO SQLData #
typedColumns :: Statement -> [Maybe ColumnType] -> IO [SQLData] #
This avoids extra API calls using the list of column types. If passed types do not correspond to the actual types, the values will be converted according to the rules at https://www.sqlite.org/c3ref/column_blob.html. If the list contains more items that number of columns, the result is undefined.
columnType :: Statement -> ColumnIndex -> IO ColumnType #
columnInt64 :: Statement -> ColumnIndex -> IO Int64 #
columnDouble :: Statement -> ColumnIndex -> IO Double #
columnText :: Statement -> ColumnIndex -> IO Text #
This will throw a DecodeError
if the datum contains invalid UTF-8.
If this behavior is undesirable, you can use columnText
from
Database.SQLite3.Direct, which does not perform conversion to Text
.
columnBlob :: Statement -> ColumnIndex -> IO ByteString #
Result statistics
changes :: Database -> IO Int #
https://www.sqlite.org/c3ref/changes.html
Return the number of rows that were changed, inserted, or deleted
by the most recent INSERT
, DELETE
, or UPDATE
statement.
Create custom SQL functions
Arguments
:: Database | |
-> Text | Name of the function. |
-> Maybe ArgCount | Number of arguments. |
-> Bool | Is the function deterministic? |
-> (FuncContext -> FuncArgs -> IO ()) | Implementation of the function. |
-> IO () |
https://sqlite.org/c3ref/create_function.html
Create a custom SQL function or redefine the behavior of an existing
function. If the function is deterministic, i.e. if it always returns the
same result given the same input, you can set the boolean flag to let
sqlite
perform additional optimizations.
Arguments
:: Database | |
-> Text | Name of the function. |
-> Maybe ArgCount | Number of arguments. |
-> a | Initial aggregate state. |
-> (FuncContext -> FuncArgs -> a -> IO a) | Process one row and update the aggregate state. |
-> (FuncContext -> a -> IO ()) | Called after all rows have been processed. Can be used to construct the returned value from the aggregate state. |
-> IO () |
Like createFunction
except that it creates an aggregate function.
deleteFunction :: Database -> Text -> Maybe ArgCount -> IO () #
Delete an SQL function (scalar or aggregate).
Extract function arguments
funcArgCount :: FuncArgs -> ArgCount #
funcArgType :: FuncArgs -> ArgIndex -> IO ColumnType #
funcArgInt64 :: FuncArgs -> ArgIndex -> IO Int64 #
funcArgDouble :: FuncArgs -> ArgIndex -> IO Double #
funcArgText :: FuncArgs -> ArgIndex -> IO Text #
funcArgBlob :: FuncArgs -> ArgIndex -> IO ByteString #
Set the result of a function
funcResultSQLData :: FuncContext -> SQLData -> IO () #
funcResultInt64 :: FuncContext -> Int64 -> IO () #
funcResultDouble :: FuncContext -> Double -> IO () #
funcResultText :: FuncContext -> Text -> IO () #
funcResultBlob :: FuncContext -> ByteString -> IO () #
funcResultZeroBlob :: FuncContext -> Int -> IO () #
funcResultNull :: FuncContext -> IO () #
getFuncContextDatabase :: FuncContext -> IO Database #
Create custom collations
Arguments
:: Database | |
-> Text | Name of the collation. |
-> (Text -> Text -> Ordering) | Comparison function. |
-> IO () |
deleteCollation :: Database -> Text -> IO () #
Delete a collation.
Interrupting a long-running query
interrupt :: Database -> IO () #
https://www.sqlite.org/c3ref/interrupt.html
Cause any pending operation on the Database
handle to stop at its earliest
opportunity. This simply sets a flag and returns immediately. It does not
wait for the pending operation to finish.
You'll need to compile with -threaded
for this to do any good.
Without -threaded
, FFI calls block the whole RTS, meaning interrupt
would never run at the same time as step
.
interruptibly :: Database -> IO a -> IO a #
Make it possible to interrupt the given database operation with an
asynchronous exception. This only works if the program is compiled with
base >= 4.3 and -threaded
.
It works by running the callback in a forked thread. If interrupted,
it uses interrupt
to try to stop the operation.
Incremental blob I/O
Arguments
:: Database | |
-> Text | The symbolic name of the database (e.g. "main"). |
-> Text | The table name. |
-> Text | The column name. |
-> Int64 | The |
-> Bool | Open the blob for read-write. |
-> IO Blob |
https://www.sqlite.org/c3ref/blob_open.html
Open a blob for incremental I/O.
Arguments
:: Blob | |
-> Int64 | The |
-> IO () |
Arguments
:: Blob | |
-> Int | Number of bytes to read. |
-> Int | Offset within the blob. |
-> IO ByteString |
blobReadBuf :: Blob -> Ptr a -> Int -> Int -> IO () #
Arguments
:: Blob | |
-> ByteString | |
-> Int | Offset within the blob. |
-> IO () |
Online Backup API
backupFinish :: Backup -> IO () #
backupStep :: Backup -> Int -> IO BackupStepResult #
backupRemaining :: Backup -> IO Int #
backupPagecount :: Backup -> IO Int #
Types
Instances
Constructors
SQLInteger !Int64 | |
SQLFloat !Double | |
SQLText !Text | |
SQLBlob !ByteString | |
SQLNull |
Instances
Generic SQLData # | |
Show SQLData # | |
Eq SQLData # | |
type Rep SQLData # | |
Defined in Database.SQLite3 type Rep SQLData = D1 ('MetaData "SQLData" "Database.SQLite3" "direct-sqlite-2.3.28-LDvFYM58b207OrnadFaYjS" 'False) ((C1 ('MetaCons "SQLInteger" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64)) :+: C1 ('MetaCons "SQLFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double))) :+: (C1 ('MetaCons "SQLText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "SQLBlob" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "SQLNull" 'PrefixI 'False) (U1 :: Type -> Type)))) |
data SQLOpenFlag #
These flags are used when using the open2
function.
https://www.sqlite.org/c3ref/c_open_autoproxy.html
Constructors
Instances
Show SQLOpenFlag # | |
Defined in Database.SQLite3 Methods showsPrec :: Int -> SQLOpenFlag -> ShowS show :: SQLOpenFlag -> String showList :: [SQLOpenFlag] -> ShowS | |
Eq SQLOpenFlag # | |
Defined in Database.SQLite3 |
These VFS names are used when using the open2
function.
Exception thrown when SQLite3 reports an error.
direct-sqlite may throw other types of exceptions if you misuse the API.
Constructors
SQLError | |
Fields
|
Instances
Exception SQLError # | |
Defined in Database.SQLite3 Methods toException :: SQLError -> SomeException fromException :: SomeException -> Maybe SQLError displayException :: SQLError -> String | |
Generic SQLError # | |
Show SQLError # | |
Eq SQLError # | |
type Rep SQLError # | |
Defined in Database.SQLite3 type Rep SQLError = D1 ('MetaData "SQLError" "Database.SQLite3" "direct-sqlite-2.3.28-LDvFYM58b207OrnadFaYjS" 'False) (C1 ('MetaCons "SQLError" 'PrefixI 'True) (S1 ('MetaSel ('Just "sqlError") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Error) :*: (S1 ('MetaSel ('Just "sqlErrorDetails") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "sqlErrorContext") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))) |
data ColumnType #
Constructors
IntegerColumn | |
FloatColumn | |
TextColumn | |
BlobColumn | |
NullColumn |
Instances
Show ColumnType # | |
Defined in Database.SQLite3.Bindings.Types Methods showsPrec :: Int -> ColumnType -> ShowS show :: ColumnType -> String showList :: [ColumnType] -> ShowS | |
Eq ColumnType # | |
Defined in Database.SQLite3.Bindings.Types | |
FFIType ColumnType CColumnType # | |
Defined in Database.SQLite3.Bindings.Types |
data FuncContext #
The context in which a custom SQL function is executed.
Instances
Show FuncContext # | |
Defined in Database.SQLite3.Direct Methods showsPrec :: Int -> FuncContext -> ShowS show :: FuncContext -> String showList :: [FuncContext] -> ShowS | |
Eq FuncContext # | |
Defined in Database.SQLite3.Direct |
The type of blob handles used for incremental blob I/O
A handle for an online backup process.
Results and errors
data StepResult #
Instances
Show StepResult # | |
Defined in Database.SQLite3.Direct Methods showsPrec :: Int -> StepResult -> ShowS show :: StepResult -> String showList :: [StepResult] -> ShowS | |
Eq StepResult # | |
Defined in Database.SQLite3.Direct |
data BackupStepResult #
Constructors
BackupOK | There are still more pages to be copied. |
BackupDone | All pages were successfully copied. |
Instances
Show BackupStepResult # | |
Defined in Database.SQLite3.Direct Methods showsPrec :: Int -> BackupStepResult -> ShowS show :: BackupStepResult -> String showList :: [BackupStepResult] -> ShowS | |
Eq BackupStepResult # | |
Defined in Database.SQLite3.Direct Methods (==) :: BackupStepResult -> BackupStepResult -> Bool (/=) :: BackupStepResult -> BackupStepResult -> Bool |
Constructors
Instances
Generic Error # | |
Show Error # | |
Eq Error # | |
FFIType Error CError # | |
type Rep Error # | |
Defined in Database.SQLite3.Bindings.Types type Rep Error = D1 ('MetaData "Error" "Database.SQLite3.Bindings.Types" "direct-sqlite-2.3.28-LDvFYM58b207OrnadFaYjS" 'False) ((((((C1 ('MetaCons "ErrorOK" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorError" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorInternal" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ErrorPermission" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorAbort" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorBusy" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorLocked" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorNoMemory" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorReadOnly" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorInterrupt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIO" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorCorrupt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorNotFound" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "ErrorFull" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorCan'tOpen" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorProtocol" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ErrorEmpty" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorSchema" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorTooBig" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorConstraint" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorMismatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorMisuse" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorNoLargeFileSupport" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorAuthorization" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorFormat" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorRange" 'PrefixI 'False) (U1 :: Type -> Type)))))) :+: ((((C1 ('MetaCons "ErrorNotADatabase" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorNotice" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorWarning" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ErrorRow" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorDone" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorErrorMissingCollatingSquence" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorErrorRetry" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorErrorSnapshot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIORead" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorIOShortRead" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOWrite" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorIOFsync" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIODirectoryFsync" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "ErrorIOTruncate" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorIOFstat" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOUnlock" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ErrorIOReadLock" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorIOBlocked" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIODelete" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorIONoMemory" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorIOAccess" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOCheckReservedLock" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorIOLock" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOClose" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorIODirectoryClose" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOShmOpen" 'PrefixI 'False) (U1 :: Type -> Type))))))) :+: (((((C1 ('MetaCons "ErrorIOShmSize" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorIOShmLock" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOShmMap" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ErrorIOSeek" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorIODeleteNoEntity" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOMmap" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorIOGetTempPath" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorIOConvertedPath" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOVNode" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorIOAuth" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIOBeginAtomic" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorIOCommitAtomic" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorIORollbackAtomic" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "ErrorIOData" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorIOCorruptFilesystem" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorLockedSharedCache" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ErrorLockedVirtualTable" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorBusyRecovery" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorBusySnapshot" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorBusyTimeout" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorCan'tOpenNotTempDirectory" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorCan'tOpenIsDirectory" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorCan'tOpenFullPath" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorCan'tOpenConvertedPath" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorCan'tOpenDirtyWriteAheadLog" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorCan'tOpenSymlink" 'PrefixI 'False) (U1 :: Type -> Type)))))) :+: ((((C1 ('MetaCons "ErrorCorruptVirtualTable" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorCorruptSequence" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorCorruptIndex" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ErrorReadOnlyRecovery" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorReadOnlyCan'tLock" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorReadOnlyRollback" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorReadOnlyDatabaseMoved" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorReadOnlyCan'tInit" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorReadOnlyDirectory" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorAbortRollback" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorConstraintCheck" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorConstraintCommitHook" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorConstraintForeignKey" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "ErrorConstraintFunction" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorConstraintNotNull" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorConstraintPrimaryKey" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorConstraintTrigger" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorConstraintUnique" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorConstraintVirtualTable" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorConstraintRowId" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ErrorConstraintPinned" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorConstraintDataType" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorNoticeRecoverWriteAheadLog" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ErrorNoticeRecoverRollback" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorWarningAutoIndex" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ErrorAuthUser" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ErrorOkLoadPermanently" 'PrefixI 'False) (U1 :: Type -> Type)))))))) |
Special integers
newtype ParamIndex #
Index of a parameter in a parameterized query. Parameter indices start from 1.
When a query is prepare
d, SQLite allocates an
array indexed from 1 to the highest parameter index. For example:
>Right stmt <- prepare conn "SELECT ?1, ?5, ?3, ?" >bindParameterCount stmt ParamIndex 6
This will allocate an array indexed from 1 to 6 (?
takes the highest
preceding index plus one). The array is initialized with null values.
When you bind a parameter with bindSQLData
, it assigns a
new value to one of these indices.
See https://www.sqlite.org/lang_expr.html#varparam for the syntax of parameter placeholders, and how parameter indices are assigned.
Constructors
ParamIndex Int |
Instances
newtype ColumnIndex #
Index of a column in a result set. Column indices start from 0.
Constructors
ColumnIndex Int |
Instances
type ColumnCount = ColumnIndex #
Number of columns in a result set.
Number of arguments of a user defined SQL function.
Constructors
ArgCount Int |
Instances
Bounded ArgCount # | |
Defined in Database.SQLite3.Bindings.Types | |
Enum ArgCount # | |
Defined in Database.SQLite3.Bindings.Types | |
Num ArgCount # | |
Integral ArgCount # | |
Defined in Database.SQLite3.Bindings.Types | |
Real ArgCount # | |
Defined in Database.SQLite3.Bindings.Types Methods toRational :: ArgCount -> Rational | |
Show ArgCount # | This just shows the underlying integer, without the data constructor. |
Eq ArgCount # | |
Ord ArgCount # | |
Defined in Database.SQLite3.Bindings.Types | |
FFIType ArgCount CArgCount # | |