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

Safe HaskellNone
LanguageHaskell2010

Database.SQLite3.Bindings.Types

Contents

Synopsis

Objects

Enumerations

Error

decodeError :: CError -> Error #

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.7.13). If you do, ensure that decodeError and decodeColumnType are still exhaustive.

data Error #

Constructors

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 malloc() failed

ErrorReadOnly

Attempt to write a readonly database

ErrorInterrupt

Operation terminated by sqlite3_interrupt()

ErrorIO

Some kind of disk I/O error occurred

ErrorCorrupt

The database disk image is malformed

ErrorNotFound

Unknown opcode in sqlite3_file_control()

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

ErrorRow

sqlite3_step() has another row ready

ErrorDone

sqlite3_step() has finished executing

Instances

Eq Error # 

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Show Error # 

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

FFIType Error CError # 

Methods

toFFI :: Error -> CError #

fromFFI :: CError -> Error #

ColumnType

decodeColumnType :: CColumnType -> ColumnType #

Note that this is a partial function. See decodeError for more information.

Indices

newtype ParamIndex #

Index of a parameter in a parameterized query. Parameter indices start from 1.

When a query is prepared, 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 http://www.sqlite.org/lang_expr.html#varparam for the syntax of parameter placeholders, and how parameter indices are assigned.

Constructors

ParamIndex Int 

Instances

Bounded ParamIndex #

Limit min/max bounds to fit into SQLite's native parameter ranges.

Enum ParamIndex # 
Eq ParamIndex # 
Integral ParamIndex # 
Num ParamIndex # 
Ord ParamIndex # 
Real ParamIndex # 
Show ParamIndex #

This just shows the underlying integer, without the data constructor.

FFIType ParamIndex CParamIndex # 

newtype ColumnIndex #

Index of a column in a result set. Column indices start from 0.

Constructors

ColumnIndex Int 

Instances

Bounded ColumnIndex #

Limit min/max bounds to fit into SQLite's native parameter ranges.

Enum ColumnIndex # 
Eq ColumnIndex # 
Integral ColumnIndex # 
Num ColumnIndex # 
Ord ColumnIndex # 
Real ColumnIndex # 
Show ColumnIndex #

This just shows the underlying integer, without the data constructor.

FFIType ColumnIndex CColumnIndex # 

type ColumnCount = ColumnIndex #

Number of columns in a result set.

Indices (FFI)

newtype CParamIndex #

Constructors

CParamIndex CInt 

Instances

Enum CParamIndex # 
Eq CParamIndex # 
Integral CParamIndex # 
Num CParamIndex # 
Ord CParamIndex # 
Real CParamIndex # 
Show CParamIndex #

This just shows the underlying integer, without the data constructor.

FFIType ParamIndex CParamIndex # 

newtype CColumnIndex #

Constructors

CColumnIndex CInt 

Instances

Enum CColumnIndex # 
Eq CColumnIndex # 
Integral CColumnIndex # 
Num CColumnIndex # 
Ord CColumnIndex # 
Real CColumnIndex # 
Show CColumnIndex #

This just shows the underlying integer, without the data constructor.

FFIType ColumnIndex CColumnIndex # 

Miscellaneous

newtype CNumBytes #

Constructors

CNumBytes CInt 

Instances

Enum CNumBytes # 
Eq CNumBytes # 
Integral CNumBytes # 
Num CNumBytes # 
Ord CNumBytes # 
Real CNumBytes # 
Show CNumBytes # 

data CDestructor #

http://www.sqlite.org/c3ref/c_static.html

Ptr CDestructor = sqlite3_destructor_type

c_SQLITE_TRANSIENT :: Ptr CDestructor #

Tells SQLite3 to make its own private copy of the data

Custom functions

newtype ArgCount #

Number of arguments of a user defined SQL function.

Constructors

ArgCount Int 

Instances

Bounded ArgCount # 
Enum ArgCount # 
Eq ArgCount # 
Integral ArgCount # 
Num ArgCount # 
Ord ArgCount # 
Real ArgCount # 
Show ArgCount #

This just shows the underlying integer, without the data constructor.

FFIType ArgCount CArgCount # 

type ArgIndex = ArgCount #

Index of an argument to a custom function. Indices start from 0.

newtype CArgCount #

Constructors

CArgCount CInt 

Instances

Bounded CArgCount # 
Enum CArgCount # 
Eq CArgCount # 
Integral CArgCount # 
Num CArgCount # 
Ord CArgCount # 
Real CArgCount # 
Show CArgCount #

This just shows the underlying integer, without the data constructor.

FFIType ArgCount CArgCount # 

c_SQLITE_DETERMINISTIC :: CInt #

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 #

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.

Minimal complete definition

toFFI, fromFFI

Methods

toFFI :: public -> ffi #

fromFFI :: ffi -> public #