Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data CDatabase
- data CStatement
- data CValue
- data CContext
- data CBlob
- data CBackup
- newtype CError = CError CInt
- decodeError :: CError -> Error
- encodeError :: Error -> CError
- 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
- newtype CColumnType = CColumnType CInt
- decodeColumnType :: CColumnType -> ColumnType
- encodeColumnType :: ColumnType -> CColumnType
- data ColumnType
- newtype ParamIndex = ParamIndex Int
- newtype ColumnIndex = ColumnIndex Int
- type ColumnCount = ColumnIndex
- newtype CParamIndex = CParamIndex CInt
- newtype CColumnIndex = CColumnIndex CInt
- type CColumnCount = CColumnIndex
- newtype CNumBytes = CNumBytes CInt
- data CDestructor
- c_SQLITE_STATIC :: Ptr CDestructor
- c_SQLITE_TRANSIENT :: Ptr CDestructor
- c_SQLITE_UTF8 :: CInt
- newtype ArgCount = ArgCount Int
- type ArgIndex = ArgCount
- newtype CArgCount = CArgCount CInt
- c_SQLITE_DETERMINISTIC :: CInt
- class FFIType public ffi | public -> ffi, ffi -> public where
Objects
https://www.sqlite.org/c3ref/sqlite3.html
CDatabase
= sqlite3
data CStatement Source #
https://www.sqlite.org/c3ref/stmt.html
CStatement
= sqlite3_stmt
https://www.sqlite.org/c3ref/value.html
CValue
= sqlite3_value
https://www.sqlite.org/c3ref/context.html
CContext
= sqlite3_context
https://www.sqlite.org/c3ref/blob.html
CBlob
= sqlite3_blob
https://www.sqlite.org/c3ref/backup.html
CBackup
= sqlite3_backup
Enumerations
Error
decodeError :: CError -> Error Source #
Note that this is a partial function. If the error code is invalid, or perhaps introduced in a newer version of SQLite but this library has not been updated to support it, the result is undefined.
To be clear, if decodeError
fails, it is undefined behavior, not an
exception you can handle.
Therefore, do not use direct-sqlite with a different version of SQLite than
the one bundled (currently, 3.24.0). If you do, ensure that decodeError
and decodeColumnType
are still exhaustive.
encodeError :: Error -> CError Source #
ErrorOK | Successful result |
ErrorError | SQL error or missing database |
ErrorInternal | Internal logic error in SQLite |
ErrorPermission | Access permission denied |
ErrorAbort | Callback routine requested an abort |
ErrorBusy | The database file is locked |
ErrorLocked | A table in the database is locked |
ErrorNoMemory | A |
ErrorReadOnly | Attempt to write a readonly database |
ErrorInterrupt | Operation terminated by |
ErrorIO | Some kind of disk I/O error occurred |
ErrorCorrupt | The database disk image is malformed |
ErrorNotFound | Unknown opcode in |
ErrorFull | Insertion failed because database is full |
ErrorCan'tOpen | Unable to open the database file |
ErrorProtocol | Database lock protocol error |
ErrorEmpty | Database is empty |
ErrorSchema | The database schema changed |
ErrorTooBig | String or BLOB exceeds size limit |
ErrorConstraint | Abort due to constraint violation |
ErrorMismatch | Data type mismatch |
ErrorMisuse | Library used incorrectly |
ErrorNoLargeFileSupport | Uses OS features not supported on host |
ErrorAuthorization | Authorization denied |
ErrorFormat | Auxiliary database format error |
ErrorRange | 2nd parameter to sqlite3_bind out of range |
ErrorNotADatabase | File opened that is not a database file |
ErrorNotice | Notifications from sqlite3_log() |
ErrorWarning | Warnings from sqlite3_log() |
ErrorRow |
|
ErrorDone |
|
ColumnType
newtype CColumnType Source #
Instances
Show CColumnType Source # | |
Defined in Database.SQLite3.Bindings.Types showsPrec :: Int -> CColumnType -> ShowS # show :: CColumnType -> String # showList :: [CColumnType] -> ShowS # | |
Eq CColumnType Source # | |
Defined in Database.SQLite3.Bindings.Types (==) :: CColumnType -> CColumnType -> Bool # (/=) :: CColumnType -> CColumnType -> Bool # | |
FFIType ColumnType CColumnType Source # | |
Defined in Database.SQLite3.Bindings.Types toFFI :: ColumnType -> CColumnType Source # fromFFI :: CColumnType -> ColumnType Source # |
decodeColumnType :: CColumnType -> ColumnType Source #
Note that this is a partial function.
See decodeError
for more information.
data ColumnType Source #
Instances
Show ColumnType Source # | |
Defined in Database.SQLite3.Bindings.Types showsPrec :: Int -> ColumnType -> ShowS # show :: ColumnType -> String # showList :: [ColumnType] -> ShowS # | |
Eq ColumnType Source # | |
Defined in Database.SQLite3.Bindings.Types (==) :: ColumnType -> ColumnType -> Bool # (/=) :: ColumnType -> ColumnType -> Bool # | |
FFIType ColumnType CColumnType Source # | |
Defined in Database.SQLite3.Bindings.Types toFFI :: ColumnType -> CColumnType Source # fromFFI :: CColumnType -> ColumnType Source # |
Indices
newtype ParamIndex Source #
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.
Instances
newtype ColumnIndex Source #
Index of a column in a result set. Column indices start from 0.
Instances
type ColumnCount = ColumnIndex Source #
Number of columns in a result set.
Indices (FFI)
newtype CParamIndex Source #
Instances
newtype CColumnIndex Source #
Instances
type CColumnCount = CColumnIndex Source #
Miscellaneous
Instances
Enum CNumBytes Source # | |
Defined in Database.SQLite3.Bindings.Types succ :: CNumBytes -> CNumBytes # pred :: CNumBytes -> CNumBytes # fromEnum :: CNumBytes -> Int # enumFrom :: CNumBytes -> [CNumBytes] # enumFromThen :: CNumBytes -> CNumBytes -> [CNumBytes] # enumFromTo :: CNumBytes -> CNumBytes -> [CNumBytes] # enumFromThenTo :: CNumBytes -> CNumBytes -> CNumBytes -> [CNumBytes] # | |
Num CNumBytes Source # | |
Defined in Database.SQLite3.Bindings.Types | |
Integral CNumBytes Source # | |
Defined in Database.SQLite3.Bindings.Types | |
Real CNumBytes Source # | |
Defined in Database.SQLite3.Bindings.Types toRational :: CNumBytes -> Rational # | |
Show CNumBytes Source # | |
Eq CNumBytes Source # | |
Ord CNumBytes Source # | |
Defined in Database.SQLite3.Bindings.Types |
data CDestructor Source #
https://www.sqlite.org/c3ref/c_static.html
Ptr CDestructor
= sqlite3_destructor_type
c_SQLITE_STATIC :: Ptr CDestructor Source #
Tells SQLite3 that the content pointer is constant and will never change
c_SQLITE_TRANSIENT :: Ptr CDestructor Source #
Tells SQLite3 to make its own private copy of the data
c_SQLITE_UTF8 :: CInt Source #
Custom functions
Number of arguments of a user defined SQL function.
Instances
Bounded ArgCount Source # | |
Enum ArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types | |
Num ArgCount Source # | |
Integral ArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types | |
Real ArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types toRational :: ArgCount -> Rational # | |
Show ArgCount Source # | This just shows the underlying integer, without the data constructor. |
Eq ArgCount Source # | |
Ord ArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types | |
FFIType ArgCount CArgCount Source # | |
Instances
Bounded CArgCount Source # | |
Enum CArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types succ :: CArgCount -> CArgCount # pred :: CArgCount -> CArgCount # fromEnum :: CArgCount -> Int # enumFrom :: CArgCount -> [CArgCount] # enumFromThen :: CArgCount -> CArgCount -> [CArgCount] # enumFromTo :: CArgCount -> CArgCount -> [CArgCount] # enumFromThenTo :: CArgCount -> CArgCount -> CArgCount -> [CArgCount] # | |
Num CArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types | |
Integral CArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types | |
Real CArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types toRational :: CArgCount -> Rational # | |
Show CArgCount Source # | This just shows the underlying integer, without the data constructor. |
Eq CArgCount Source # | |
Ord CArgCount Source # | |
Defined in Database.SQLite3.Bindings.Types | |
FFIType ArgCount CArgCount Source # | |
c_SQLITE_DETERMINISTIC :: CInt Source #
Tells SQLite3 that the defined custom SQL function is deterministic.
Conversion to and from FFI types
class FFIType public ffi | public -> ffi, ffi -> public where Source #
The Database.SQLite3 and Database.SQLite3.Direct modules use higher-level representations of some types than those used in the FFI signatures (Database.SQLite3.Bindings). This typeclass helps with the conversions.
Instances
FFIType ArgCount CArgCount Source # | |
FFIType ColumnIndex CColumnIndex Source # | |
Defined in Database.SQLite3.Bindings.Types toFFI :: ColumnIndex -> CColumnIndex Source # fromFFI :: CColumnIndex -> ColumnIndex Source # | |
FFIType ColumnType CColumnType Source # | |
Defined in Database.SQLite3.Bindings.Types toFFI :: ColumnType -> CColumnType Source # fromFFI :: CColumnType -> ColumnType Source # | |
FFIType Error CError Source # | |
FFIType ParamIndex CParamIndex Source # | |
Defined in Database.SQLite3.Bindings.Types toFFI :: ParamIndex -> CParamIndex Source # fromFFI :: CParamIndex -> ParamIndex Source # |