{-# LINE 1 "Database/SQLite3/Bindings/Types.hsc" #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Database.SQLite3.Bindings.Types (
    -- * Objects
    -- | <https://www.sqlite.org/c3ref/objlist.html>
    CDatabase,
    CStatement,
    CValue,
    CContext,
    CBlob,
    CBackup,

    -- * Enumerations

    -- ** Error
    CError(..),
    decodeError,
    encodeError,
    Error(..),

    -- ** ColumnType
    CColumnType(..),
    decodeColumnType,
    encodeColumnType,
    ColumnType(..),

    -- * Indices
    ParamIndex(..),
    ColumnIndex(..),
    ColumnCount,

    -- ** Indices (FFI)
    CParamIndex(..),
    CColumnIndex(..),
    CColumnCount,

    -- * Miscellaneous
    CNumBytes(..),
    CDestructor,
    c_SQLITE_STATIC,
    c_SQLITE_TRANSIENT,
    c_SQLITE_UTF8,

    -- * Custom functions
    ArgCount(..),
    ArgIndex,
    CArgCount(..),
    c_SQLITE_DETERMINISTIC,

    -- * Conversion to and from FFI types
    FFIType(..),
) where


{-# LINE 59 "Database/SQLite3/Bindings/Types.hsc" #-}


{-# LINE 61 "Database/SQLite3/Bindings/Types.hsc" #-}

import Foreign.C.Types
import Foreign.Ptr

-- Result code documentation copied from <https://www.sqlite.org/c3ref/c_abort.html>

-- | <https://www.sqlite.org/c3ref/c_abort.html>
data Error = 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
           | ErrorNotice                 -- ^ Notifications from sqlite3_log()
           | ErrorWarning                -- ^ Warnings from sqlite3_log()
           | ErrorRow                    -- ^ @sqlite3_step()@ has another row ready
           | ErrorDone                   -- ^ @sqlite3_step()@ has finished executing
             deriving (Error -> Error -> Bool
(Error -> Error -> Bool) -> (Error -> Error -> Bool) -> Eq Error
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Error -> Error -> Bool
$c/= :: Error -> Error -> Bool
== :: Error -> Error -> Bool
$c== :: Error -> Error -> Bool
Eq, Int -> Error -> ShowS
[Error] -> ShowS
Error -> String
(Int -> Error -> ShowS)
-> (Error -> String) -> ([Error] -> ShowS) -> Show Error
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Error] -> ShowS
$cshowList :: [Error] -> ShowS
show :: Error -> String
$cshow :: Error -> String
showsPrec :: Int -> Error -> ShowS
$cshowsPrec :: Int -> Error -> ShowS
Show)

-- | <https://www.sqlite.org/c3ref/c_blob.html>
data ColumnType = IntegerColumn
                | FloatColumn
                | TextColumn
                | BlobColumn
                | NullColumn
                  deriving (ColumnType -> ColumnType -> Bool
(ColumnType -> ColumnType -> Bool)
-> (ColumnType -> ColumnType -> Bool) -> Eq ColumnType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnType -> ColumnType -> Bool
$c/= :: ColumnType -> ColumnType -> Bool
== :: ColumnType -> ColumnType -> Bool
$c== :: ColumnType -> ColumnType -> Bool
Eq, Int -> ColumnType -> ShowS
[ColumnType] -> ShowS
ColumnType -> String
(Int -> ColumnType -> ShowS)
-> (ColumnType -> String)
-> ([ColumnType] -> ShowS)
-> Show ColumnType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnType] -> ShowS
$cshowList :: [ColumnType] -> ShowS
show :: ColumnType -> String
$cshow :: ColumnType -> String
showsPrec :: Int -> ColumnType -> ShowS
$cshowsPrec :: Int -> ColumnType -> ShowS
Show)

-- | <https://www.sqlite.org/c3ref/sqlite3.html>
--
-- @CDatabase@ = @sqlite3@
data CDatabase

-- | <https://www.sqlite.org/c3ref/stmt.html>
--
-- @CStatement@ = @sqlite3_stmt@
data CStatement

-- | <https://www.sqlite.org/c3ref/value.html>
--
-- @CValue@ = @sqlite3_value@
data CValue

-- | <https://www.sqlite.org/c3ref/context.html>
--
-- @CContext@ = @sqlite3_context@
data CContext

-- | <https://www.sqlite.org/c3ref/blob.html>
--
-- @CBlob@ = @sqlite3_blob@
data CBlob

-- | <https://www.sqlite.org/c3ref/backup.html>
--
-- @CBackup@ = @sqlite3_backup@
data CBackup

-- | Index of a parameter in a parameterized query.
-- Parameter indices start from 1.
--
-- When a query is 'Database.SQLite3.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 'Database.SQLite3.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.
newtype ParamIndex = ParamIndex Int
    deriving (ParamIndex -> ParamIndex -> Bool
(ParamIndex -> ParamIndex -> Bool)
-> (ParamIndex -> ParamIndex -> Bool) -> Eq ParamIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParamIndex -> ParamIndex -> Bool
$c/= :: ParamIndex -> ParamIndex -> Bool
== :: ParamIndex -> ParamIndex -> Bool
$c== :: ParamIndex -> ParamIndex -> Bool
Eq, Eq ParamIndex
Eq ParamIndex
-> (ParamIndex -> ParamIndex -> Ordering)
-> (ParamIndex -> ParamIndex -> Bool)
-> (ParamIndex -> ParamIndex -> Bool)
-> (ParamIndex -> ParamIndex -> Bool)
-> (ParamIndex -> ParamIndex -> Bool)
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> Ord ParamIndex
ParamIndex -> ParamIndex -> Bool
ParamIndex -> ParamIndex -> Ordering
ParamIndex -> ParamIndex -> ParamIndex
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ParamIndex -> ParamIndex -> ParamIndex
$cmin :: ParamIndex -> ParamIndex -> ParamIndex
max :: ParamIndex -> ParamIndex -> ParamIndex
$cmax :: ParamIndex -> ParamIndex -> ParamIndex
>= :: ParamIndex -> ParamIndex -> Bool
$c>= :: ParamIndex -> ParamIndex -> Bool
> :: ParamIndex -> ParamIndex -> Bool
$c> :: ParamIndex -> ParamIndex -> Bool
<= :: ParamIndex -> ParamIndex -> Bool
$c<= :: ParamIndex -> ParamIndex -> Bool
< :: ParamIndex -> ParamIndex -> Bool
$c< :: ParamIndex -> ParamIndex -> Bool
compare :: ParamIndex -> ParamIndex -> Ordering
$ccompare :: ParamIndex -> ParamIndex -> Ordering
$cp1Ord :: Eq ParamIndex
Ord, Int -> ParamIndex
ParamIndex -> Int
ParamIndex -> [ParamIndex]
ParamIndex -> ParamIndex
ParamIndex -> ParamIndex -> [ParamIndex]
ParamIndex -> ParamIndex -> ParamIndex -> [ParamIndex]
(ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex)
-> (Int -> ParamIndex)
-> (ParamIndex -> Int)
-> (ParamIndex -> [ParamIndex])
-> (ParamIndex -> ParamIndex -> [ParamIndex])
-> (ParamIndex -> ParamIndex -> [ParamIndex])
-> (ParamIndex -> ParamIndex -> ParamIndex -> [ParamIndex])
-> Enum ParamIndex
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ParamIndex -> ParamIndex -> ParamIndex -> [ParamIndex]
$cenumFromThenTo :: ParamIndex -> ParamIndex -> ParamIndex -> [ParamIndex]
enumFromTo :: ParamIndex -> ParamIndex -> [ParamIndex]
$cenumFromTo :: ParamIndex -> ParamIndex -> [ParamIndex]
enumFromThen :: ParamIndex -> ParamIndex -> [ParamIndex]
$cenumFromThen :: ParamIndex -> ParamIndex -> [ParamIndex]
enumFrom :: ParamIndex -> [ParamIndex]
$cenumFrom :: ParamIndex -> [ParamIndex]
fromEnum :: ParamIndex -> Int
$cfromEnum :: ParamIndex -> Int
toEnum :: Int -> ParamIndex
$ctoEnum :: Int -> ParamIndex
pred :: ParamIndex -> ParamIndex
$cpred :: ParamIndex -> ParamIndex
succ :: ParamIndex -> ParamIndex
$csucc :: ParamIndex -> ParamIndex
Enum, Integer -> ParamIndex
ParamIndex -> ParamIndex
ParamIndex -> ParamIndex -> ParamIndex
(ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex)
-> (Integer -> ParamIndex)
-> Num ParamIndex
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> ParamIndex
$cfromInteger :: Integer -> ParamIndex
signum :: ParamIndex -> ParamIndex
$csignum :: ParamIndex -> ParamIndex
abs :: ParamIndex -> ParamIndex
$cabs :: ParamIndex -> ParamIndex
negate :: ParamIndex -> ParamIndex
$cnegate :: ParamIndex -> ParamIndex
* :: ParamIndex -> ParamIndex -> ParamIndex
$c* :: ParamIndex -> ParamIndex -> ParamIndex
- :: ParamIndex -> ParamIndex -> ParamIndex
$c- :: ParamIndex -> ParamIndex -> ParamIndex
+ :: ParamIndex -> ParamIndex -> ParamIndex
$c+ :: ParamIndex -> ParamIndex -> ParamIndex
Num, Num ParamIndex
Ord ParamIndex
Num ParamIndex
-> Ord ParamIndex -> (ParamIndex -> Rational) -> Real ParamIndex
ParamIndex -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: ParamIndex -> Rational
$ctoRational :: ParamIndex -> Rational
$cp2Real :: Ord ParamIndex
$cp1Real :: Num ParamIndex
Real, Enum ParamIndex
Real ParamIndex
Real ParamIndex
-> Enum ParamIndex
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex -> ParamIndex)
-> (ParamIndex -> ParamIndex -> (ParamIndex, ParamIndex))
-> (ParamIndex -> ParamIndex -> (ParamIndex, ParamIndex))
-> (ParamIndex -> Integer)
-> Integral ParamIndex
ParamIndex -> Integer
ParamIndex -> ParamIndex -> (ParamIndex, ParamIndex)
ParamIndex -> ParamIndex -> ParamIndex
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: ParamIndex -> Integer
$ctoInteger :: ParamIndex -> Integer
divMod :: ParamIndex -> ParamIndex -> (ParamIndex, ParamIndex)
$cdivMod :: ParamIndex -> ParamIndex -> (ParamIndex, ParamIndex)
quotRem :: ParamIndex -> ParamIndex -> (ParamIndex, ParamIndex)
$cquotRem :: ParamIndex -> ParamIndex -> (ParamIndex, ParamIndex)
mod :: ParamIndex -> ParamIndex -> ParamIndex
$cmod :: ParamIndex -> ParamIndex -> ParamIndex
div :: ParamIndex -> ParamIndex -> ParamIndex
$cdiv :: ParamIndex -> ParamIndex -> ParamIndex
rem :: ParamIndex -> ParamIndex -> ParamIndex
$crem :: ParamIndex -> ParamIndex -> ParamIndex
quot :: ParamIndex -> ParamIndex -> ParamIndex
$cquot :: ParamIndex -> ParamIndex -> ParamIndex
$cp2Integral :: Enum ParamIndex
$cp1Integral :: Real ParamIndex
Integral)

-- | This just shows the underlying integer, without the data constructor.
instance Show ParamIndex where
    show :: ParamIndex -> String
show (ParamIndex Int
n) = Int -> String
forall a. Show a => a -> String
show Int
n

-- | Limit min/max bounds to fit into SQLite's native parameter ranges.
instance Bounded ParamIndex where
    minBound :: ParamIndex
minBound = Int -> ParamIndex
ParamIndex (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt
forall a. Bounded a => a
minBound :: CInt))
    maxBound :: ParamIndex
maxBound = Int -> ParamIndex
ParamIndex (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt
forall a. Bounded a => a
maxBound :: CInt))

-- | Index of a column in a result set.  Column indices start from 0.
newtype ColumnIndex = ColumnIndex Int
    deriving (ColumnIndex -> ColumnIndex -> Bool
(ColumnIndex -> ColumnIndex -> Bool)
-> (ColumnIndex -> ColumnIndex -> Bool) -> Eq ColumnIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnIndex -> ColumnIndex -> Bool
$c/= :: ColumnIndex -> ColumnIndex -> Bool
== :: ColumnIndex -> ColumnIndex -> Bool
$c== :: ColumnIndex -> ColumnIndex -> Bool
Eq, Eq ColumnIndex
Eq ColumnIndex
-> (ColumnIndex -> ColumnIndex -> Ordering)
-> (ColumnIndex -> ColumnIndex -> Bool)
-> (ColumnIndex -> ColumnIndex -> Bool)
-> (ColumnIndex -> ColumnIndex -> Bool)
-> (ColumnIndex -> ColumnIndex -> Bool)
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> Ord ColumnIndex
ColumnIndex -> ColumnIndex -> Bool
ColumnIndex -> ColumnIndex -> Ordering
ColumnIndex -> ColumnIndex -> ColumnIndex
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ColumnIndex -> ColumnIndex -> ColumnIndex
$cmin :: ColumnIndex -> ColumnIndex -> ColumnIndex
max :: ColumnIndex -> ColumnIndex -> ColumnIndex
$cmax :: ColumnIndex -> ColumnIndex -> ColumnIndex
>= :: ColumnIndex -> ColumnIndex -> Bool
$c>= :: ColumnIndex -> ColumnIndex -> Bool
> :: ColumnIndex -> ColumnIndex -> Bool
$c> :: ColumnIndex -> ColumnIndex -> Bool
<= :: ColumnIndex -> ColumnIndex -> Bool
$c<= :: ColumnIndex -> ColumnIndex -> Bool
< :: ColumnIndex -> ColumnIndex -> Bool
$c< :: ColumnIndex -> ColumnIndex -> Bool
compare :: ColumnIndex -> ColumnIndex -> Ordering
$ccompare :: ColumnIndex -> ColumnIndex -> Ordering
$cp1Ord :: Eq ColumnIndex
Ord, Int -> ColumnIndex
ColumnIndex -> Int
ColumnIndex -> [ColumnIndex]
ColumnIndex -> ColumnIndex
ColumnIndex -> ColumnIndex -> [ColumnIndex]
ColumnIndex -> ColumnIndex -> ColumnIndex -> [ColumnIndex]
(ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex)
-> (Int -> ColumnIndex)
-> (ColumnIndex -> Int)
-> (ColumnIndex -> [ColumnIndex])
-> (ColumnIndex -> ColumnIndex -> [ColumnIndex])
-> (ColumnIndex -> ColumnIndex -> [ColumnIndex])
-> (ColumnIndex -> ColumnIndex -> ColumnIndex -> [ColumnIndex])
-> Enum ColumnIndex
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ColumnIndex -> ColumnIndex -> ColumnIndex -> [ColumnIndex]
$cenumFromThenTo :: ColumnIndex -> ColumnIndex -> ColumnIndex -> [ColumnIndex]
enumFromTo :: ColumnIndex -> ColumnIndex -> [ColumnIndex]
$cenumFromTo :: ColumnIndex -> ColumnIndex -> [ColumnIndex]
enumFromThen :: ColumnIndex -> ColumnIndex -> [ColumnIndex]
$cenumFromThen :: ColumnIndex -> ColumnIndex -> [ColumnIndex]
enumFrom :: ColumnIndex -> [ColumnIndex]
$cenumFrom :: ColumnIndex -> [ColumnIndex]
fromEnum :: ColumnIndex -> Int
$cfromEnum :: ColumnIndex -> Int
toEnum :: Int -> ColumnIndex
$ctoEnum :: Int -> ColumnIndex
pred :: ColumnIndex -> ColumnIndex
$cpred :: ColumnIndex -> ColumnIndex
succ :: ColumnIndex -> ColumnIndex
$csucc :: ColumnIndex -> ColumnIndex
Enum, Integer -> ColumnIndex
ColumnIndex -> ColumnIndex
ColumnIndex -> ColumnIndex -> ColumnIndex
(ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex)
-> (Integer -> ColumnIndex)
-> Num ColumnIndex
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> ColumnIndex
$cfromInteger :: Integer -> ColumnIndex
signum :: ColumnIndex -> ColumnIndex
$csignum :: ColumnIndex -> ColumnIndex
abs :: ColumnIndex -> ColumnIndex
$cabs :: ColumnIndex -> ColumnIndex
negate :: ColumnIndex -> ColumnIndex
$cnegate :: ColumnIndex -> ColumnIndex
* :: ColumnIndex -> ColumnIndex -> ColumnIndex
$c* :: ColumnIndex -> ColumnIndex -> ColumnIndex
- :: ColumnIndex -> ColumnIndex -> ColumnIndex
$c- :: ColumnIndex -> ColumnIndex -> ColumnIndex
+ :: ColumnIndex -> ColumnIndex -> ColumnIndex
$c+ :: ColumnIndex -> ColumnIndex -> ColumnIndex
Num, Num ColumnIndex
Ord ColumnIndex
Num ColumnIndex
-> Ord ColumnIndex -> (ColumnIndex -> Rational) -> Real ColumnIndex
ColumnIndex -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: ColumnIndex -> Rational
$ctoRational :: ColumnIndex -> Rational
$cp2Real :: Ord ColumnIndex
$cp1Real :: Num ColumnIndex
Real, Enum ColumnIndex
Real ColumnIndex
Real ColumnIndex
-> Enum ColumnIndex
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex -> ColumnIndex)
-> (ColumnIndex -> ColumnIndex -> (ColumnIndex, ColumnIndex))
-> (ColumnIndex -> ColumnIndex -> (ColumnIndex, ColumnIndex))
-> (ColumnIndex -> Integer)
-> Integral ColumnIndex
ColumnIndex -> Integer
ColumnIndex -> ColumnIndex -> (ColumnIndex, ColumnIndex)
ColumnIndex -> ColumnIndex -> ColumnIndex
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: ColumnIndex -> Integer
$ctoInteger :: ColumnIndex -> Integer
divMod :: ColumnIndex -> ColumnIndex -> (ColumnIndex, ColumnIndex)
$cdivMod :: ColumnIndex -> ColumnIndex -> (ColumnIndex, ColumnIndex)
quotRem :: ColumnIndex -> ColumnIndex -> (ColumnIndex, ColumnIndex)
$cquotRem :: ColumnIndex -> ColumnIndex -> (ColumnIndex, ColumnIndex)
mod :: ColumnIndex -> ColumnIndex -> ColumnIndex
$cmod :: ColumnIndex -> ColumnIndex -> ColumnIndex
div :: ColumnIndex -> ColumnIndex -> ColumnIndex
$cdiv :: ColumnIndex -> ColumnIndex -> ColumnIndex
rem :: ColumnIndex -> ColumnIndex -> ColumnIndex
$crem :: ColumnIndex -> ColumnIndex -> ColumnIndex
quot :: ColumnIndex -> ColumnIndex -> ColumnIndex
$cquot :: ColumnIndex -> ColumnIndex -> ColumnIndex
$cp2Integral :: Enum ColumnIndex
$cp1Integral :: Real ColumnIndex
Integral)

-- | This just shows the underlying integer, without the data constructor.
instance Show ColumnIndex where
    show :: ColumnIndex -> String
show (ColumnIndex Int
n) = Int -> String
forall a. Show a => a -> String
show Int
n

-- | Limit min/max bounds to fit into SQLite's native parameter ranges.
instance Bounded ColumnIndex where
    minBound :: ColumnIndex
minBound = Int -> ColumnIndex
ColumnIndex (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt
forall a. Bounded a => a
minBound :: CInt))
    maxBound :: ColumnIndex
maxBound = Int -> ColumnIndex
ColumnIndex (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt
forall a. Bounded a => a
maxBound :: CInt))

-- | Number of columns in a result set.
type ColumnCount = ColumnIndex

newtype CParamIndex = CParamIndex CInt
    deriving (CParamIndex -> CParamIndex -> Bool
(CParamIndex -> CParamIndex -> Bool)
-> (CParamIndex -> CParamIndex -> Bool) -> Eq CParamIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CParamIndex -> CParamIndex -> Bool
$c/= :: CParamIndex -> CParamIndex -> Bool
== :: CParamIndex -> CParamIndex -> Bool
$c== :: CParamIndex -> CParamIndex -> Bool
Eq, Eq CParamIndex
Eq CParamIndex
-> (CParamIndex -> CParamIndex -> Ordering)
-> (CParamIndex -> CParamIndex -> Bool)
-> (CParamIndex -> CParamIndex -> Bool)
-> (CParamIndex -> CParamIndex -> Bool)
-> (CParamIndex -> CParamIndex -> Bool)
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> Ord CParamIndex
CParamIndex -> CParamIndex -> Bool
CParamIndex -> CParamIndex -> Ordering
CParamIndex -> CParamIndex -> CParamIndex
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CParamIndex -> CParamIndex -> CParamIndex
$cmin :: CParamIndex -> CParamIndex -> CParamIndex
max :: CParamIndex -> CParamIndex -> CParamIndex
$cmax :: CParamIndex -> CParamIndex -> CParamIndex
>= :: CParamIndex -> CParamIndex -> Bool
$c>= :: CParamIndex -> CParamIndex -> Bool
> :: CParamIndex -> CParamIndex -> Bool
$c> :: CParamIndex -> CParamIndex -> Bool
<= :: CParamIndex -> CParamIndex -> Bool
$c<= :: CParamIndex -> CParamIndex -> Bool
< :: CParamIndex -> CParamIndex -> Bool
$c< :: CParamIndex -> CParamIndex -> Bool
compare :: CParamIndex -> CParamIndex -> Ordering
$ccompare :: CParamIndex -> CParamIndex -> Ordering
$cp1Ord :: Eq CParamIndex
Ord, Int -> CParamIndex
CParamIndex -> Int
CParamIndex -> [CParamIndex]
CParamIndex -> CParamIndex
CParamIndex -> CParamIndex -> [CParamIndex]
CParamIndex -> CParamIndex -> CParamIndex -> [CParamIndex]
(CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex)
-> (Int -> CParamIndex)
-> (CParamIndex -> Int)
-> (CParamIndex -> [CParamIndex])
-> (CParamIndex -> CParamIndex -> [CParamIndex])
-> (CParamIndex -> CParamIndex -> [CParamIndex])
-> (CParamIndex -> CParamIndex -> CParamIndex -> [CParamIndex])
-> Enum CParamIndex
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: CParamIndex -> CParamIndex -> CParamIndex -> [CParamIndex]
$cenumFromThenTo :: CParamIndex -> CParamIndex -> CParamIndex -> [CParamIndex]
enumFromTo :: CParamIndex -> CParamIndex -> [CParamIndex]
$cenumFromTo :: CParamIndex -> CParamIndex -> [CParamIndex]
enumFromThen :: CParamIndex -> CParamIndex -> [CParamIndex]
$cenumFromThen :: CParamIndex -> CParamIndex -> [CParamIndex]
enumFrom :: CParamIndex -> [CParamIndex]
$cenumFrom :: CParamIndex -> [CParamIndex]
fromEnum :: CParamIndex -> Int
$cfromEnum :: CParamIndex -> Int
toEnum :: Int -> CParamIndex
$ctoEnum :: Int -> CParamIndex
pred :: CParamIndex -> CParamIndex
$cpred :: CParamIndex -> CParamIndex
succ :: CParamIndex -> CParamIndex
$csucc :: CParamIndex -> CParamIndex
Enum, Integer -> CParamIndex
CParamIndex -> CParamIndex
CParamIndex -> CParamIndex -> CParamIndex
(CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex)
-> (Integer -> CParamIndex)
-> Num CParamIndex
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> CParamIndex
$cfromInteger :: Integer -> CParamIndex
signum :: CParamIndex -> CParamIndex
$csignum :: CParamIndex -> CParamIndex
abs :: CParamIndex -> CParamIndex
$cabs :: CParamIndex -> CParamIndex
negate :: CParamIndex -> CParamIndex
$cnegate :: CParamIndex -> CParamIndex
* :: CParamIndex -> CParamIndex -> CParamIndex
$c* :: CParamIndex -> CParamIndex -> CParamIndex
- :: CParamIndex -> CParamIndex -> CParamIndex
$c- :: CParamIndex -> CParamIndex -> CParamIndex
+ :: CParamIndex -> CParamIndex -> CParamIndex
$c+ :: CParamIndex -> CParamIndex -> CParamIndex
Num, Num CParamIndex
Ord CParamIndex
Num CParamIndex
-> Ord CParamIndex -> (CParamIndex -> Rational) -> Real CParamIndex
CParamIndex -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: CParamIndex -> Rational
$ctoRational :: CParamIndex -> Rational
$cp2Real :: Ord CParamIndex
$cp1Real :: Num CParamIndex
Real, Enum CParamIndex
Real CParamIndex
Real CParamIndex
-> Enum CParamIndex
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex -> CParamIndex)
-> (CParamIndex -> CParamIndex -> (CParamIndex, CParamIndex))
-> (CParamIndex -> CParamIndex -> (CParamIndex, CParamIndex))
-> (CParamIndex -> Integer)
-> Integral CParamIndex
CParamIndex -> Integer
CParamIndex -> CParamIndex -> (CParamIndex, CParamIndex)
CParamIndex -> CParamIndex -> CParamIndex
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: CParamIndex -> Integer
$ctoInteger :: CParamIndex -> Integer
divMod :: CParamIndex -> CParamIndex -> (CParamIndex, CParamIndex)
$cdivMod :: CParamIndex -> CParamIndex -> (CParamIndex, CParamIndex)
quotRem :: CParamIndex -> CParamIndex -> (CParamIndex, CParamIndex)
$cquotRem :: CParamIndex -> CParamIndex -> (CParamIndex, CParamIndex)
mod :: CParamIndex -> CParamIndex -> CParamIndex
$cmod :: CParamIndex -> CParamIndex -> CParamIndex
div :: CParamIndex -> CParamIndex -> CParamIndex
$cdiv :: CParamIndex -> CParamIndex -> CParamIndex
rem :: CParamIndex -> CParamIndex -> CParamIndex
$crem :: CParamIndex -> CParamIndex -> CParamIndex
quot :: CParamIndex -> CParamIndex -> CParamIndex
$cquot :: CParamIndex -> CParamIndex -> CParamIndex
$cp2Integral :: Enum CParamIndex
$cp1Integral :: Real CParamIndex
Integral)

-- | This just shows the underlying integer, without the data constructor.
instance Show CParamIndex where
    show :: CParamIndex -> String
show (CParamIndex CInt
n) = CInt -> String
forall a. Show a => a -> String
show CInt
n

newtype CColumnIndex = CColumnIndex CInt
    deriving (CColumnIndex -> CColumnIndex -> Bool
(CColumnIndex -> CColumnIndex -> Bool)
-> (CColumnIndex -> CColumnIndex -> Bool) -> Eq CColumnIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CColumnIndex -> CColumnIndex -> Bool
$c/= :: CColumnIndex -> CColumnIndex -> Bool
== :: CColumnIndex -> CColumnIndex -> Bool
$c== :: CColumnIndex -> CColumnIndex -> Bool
Eq, Eq CColumnIndex
Eq CColumnIndex
-> (CColumnIndex -> CColumnIndex -> Ordering)
-> (CColumnIndex -> CColumnIndex -> Bool)
-> (CColumnIndex -> CColumnIndex -> Bool)
-> (CColumnIndex -> CColumnIndex -> Bool)
-> (CColumnIndex -> CColumnIndex -> Bool)
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> Ord CColumnIndex
CColumnIndex -> CColumnIndex -> Bool
CColumnIndex -> CColumnIndex -> Ordering
CColumnIndex -> CColumnIndex -> CColumnIndex
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CColumnIndex -> CColumnIndex -> CColumnIndex
$cmin :: CColumnIndex -> CColumnIndex -> CColumnIndex
max :: CColumnIndex -> CColumnIndex -> CColumnIndex
$cmax :: CColumnIndex -> CColumnIndex -> CColumnIndex
>= :: CColumnIndex -> CColumnIndex -> Bool
$c>= :: CColumnIndex -> CColumnIndex -> Bool
> :: CColumnIndex -> CColumnIndex -> Bool
$c> :: CColumnIndex -> CColumnIndex -> Bool
<= :: CColumnIndex -> CColumnIndex -> Bool
$c<= :: CColumnIndex -> CColumnIndex -> Bool
< :: CColumnIndex -> CColumnIndex -> Bool
$c< :: CColumnIndex -> CColumnIndex -> Bool
compare :: CColumnIndex -> CColumnIndex -> Ordering
$ccompare :: CColumnIndex -> CColumnIndex -> Ordering
$cp1Ord :: Eq CColumnIndex
Ord, Int -> CColumnIndex
CColumnIndex -> Int
CColumnIndex -> [CColumnIndex]
CColumnIndex -> CColumnIndex
CColumnIndex -> CColumnIndex -> [CColumnIndex]
CColumnIndex -> CColumnIndex -> CColumnIndex -> [CColumnIndex]
(CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex)
-> (Int -> CColumnIndex)
-> (CColumnIndex -> Int)
-> (CColumnIndex -> [CColumnIndex])
-> (CColumnIndex -> CColumnIndex -> [CColumnIndex])
-> (CColumnIndex -> CColumnIndex -> [CColumnIndex])
-> (CColumnIndex -> CColumnIndex -> CColumnIndex -> [CColumnIndex])
-> Enum CColumnIndex
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: CColumnIndex -> CColumnIndex -> CColumnIndex -> [CColumnIndex]
$cenumFromThenTo :: CColumnIndex -> CColumnIndex -> CColumnIndex -> [CColumnIndex]
enumFromTo :: CColumnIndex -> CColumnIndex -> [CColumnIndex]
$cenumFromTo :: CColumnIndex -> CColumnIndex -> [CColumnIndex]
enumFromThen :: CColumnIndex -> CColumnIndex -> [CColumnIndex]
$cenumFromThen :: CColumnIndex -> CColumnIndex -> [CColumnIndex]
enumFrom :: CColumnIndex -> [CColumnIndex]
$cenumFrom :: CColumnIndex -> [CColumnIndex]
fromEnum :: CColumnIndex -> Int
$cfromEnum :: CColumnIndex -> Int
toEnum :: Int -> CColumnIndex
$ctoEnum :: Int -> CColumnIndex
pred :: CColumnIndex -> CColumnIndex
$cpred :: CColumnIndex -> CColumnIndex
succ :: CColumnIndex -> CColumnIndex
$csucc :: CColumnIndex -> CColumnIndex
Enum, Integer -> CColumnIndex
CColumnIndex -> CColumnIndex
CColumnIndex -> CColumnIndex -> CColumnIndex
(CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex)
-> (Integer -> CColumnIndex)
-> Num CColumnIndex
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> CColumnIndex
$cfromInteger :: Integer -> CColumnIndex
signum :: CColumnIndex -> CColumnIndex
$csignum :: CColumnIndex -> CColumnIndex
abs :: CColumnIndex -> CColumnIndex
$cabs :: CColumnIndex -> CColumnIndex
negate :: CColumnIndex -> CColumnIndex
$cnegate :: CColumnIndex -> CColumnIndex
* :: CColumnIndex -> CColumnIndex -> CColumnIndex
$c* :: CColumnIndex -> CColumnIndex -> CColumnIndex
- :: CColumnIndex -> CColumnIndex -> CColumnIndex
$c- :: CColumnIndex -> CColumnIndex -> CColumnIndex
+ :: CColumnIndex -> CColumnIndex -> CColumnIndex
$c+ :: CColumnIndex -> CColumnIndex -> CColumnIndex
Num, Num CColumnIndex
Ord CColumnIndex
Num CColumnIndex
-> Ord CColumnIndex
-> (CColumnIndex -> Rational)
-> Real CColumnIndex
CColumnIndex -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: CColumnIndex -> Rational
$ctoRational :: CColumnIndex -> Rational
$cp2Real :: Ord CColumnIndex
$cp1Real :: Num CColumnIndex
Real, Enum CColumnIndex
Real CColumnIndex
Real CColumnIndex
-> Enum CColumnIndex
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex -> CColumnIndex)
-> (CColumnIndex -> CColumnIndex -> (CColumnIndex, CColumnIndex))
-> (CColumnIndex -> CColumnIndex -> (CColumnIndex, CColumnIndex))
-> (CColumnIndex -> Integer)
-> Integral CColumnIndex
CColumnIndex -> Integer
CColumnIndex -> CColumnIndex -> (CColumnIndex, CColumnIndex)
CColumnIndex -> CColumnIndex -> CColumnIndex
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: CColumnIndex -> Integer
$ctoInteger :: CColumnIndex -> Integer
divMod :: CColumnIndex -> CColumnIndex -> (CColumnIndex, CColumnIndex)
$cdivMod :: CColumnIndex -> CColumnIndex -> (CColumnIndex, CColumnIndex)
quotRem :: CColumnIndex -> CColumnIndex -> (CColumnIndex, CColumnIndex)
$cquotRem :: CColumnIndex -> CColumnIndex -> (CColumnIndex, CColumnIndex)
mod :: CColumnIndex -> CColumnIndex -> CColumnIndex
$cmod :: CColumnIndex -> CColumnIndex -> CColumnIndex
div :: CColumnIndex -> CColumnIndex -> CColumnIndex
$cdiv :: CColumnIndex -> CColumnIndex -> CColumnIndex
rem :: CColumnIndex -> CColumnIndex -> CColumnIndex
$crem :: CColumnIndex -> CColumnIndex -> CColumnIndex
quot :: CColumnIndex -> CColumnIndex -> CColumnIndex
$cquot :: CColumnIndex -> CColumnIndex -> CColumnIndex
$cp2Integral :: Enum CColumnIndex
$cp1Integral :: Real CColumnIndex
Integral)

-- | This just shows the underlying integer, without the data constructor.
instance Show CColumnIndex where
    show :: CColumnIndex -> String
show (CColumnIndex CInt
n) = CInt -> String
forall a. Show a => a -> String
show CInt
n

type CColumnCount = CColumnIndex

newtype CNumBytes = CNumBytes CInt
    deriving (CNumBytes -> CNumBytes -> Bool
(CNumBytes -> CNumBytes -> Bool)
-> (CNumBytes -> CNumBytes -> Bool) -> Eq CNumBytes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CNumBytes -> CNumBytes -> Bool
$c/= :: CNumBytes -> CNumBytes -> Bool
== :: CNumBytes -> CNumBytes -> Bool
$c== :: CNumBytes -> CNumBytes -> Bool
Eq, Eq CNumBytes
Eq CNumBytes
-> (CNumBytes -> CNumBytes -> Ordering)
-> (CNumBytes -> CNumBytes -> Bool)
-> (CNumBytes -> CNumBytes -> Bool)
-> (CNumBytes -> CNumBytes -> Bool)
-> (CNumBytes -> CNumBytes -> Bool)
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> Ord CNumBytes
CNumBytes -> CNumBytes -> Bool
CNumBytes -> CNumBytes -> Ordering
CNumBytes -> CNumBytes -> CNumBytes
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CNumBytes -> CNumBytes -> CNumBytes
$cmin :: CNumBytes -> CNumBytes -> CNumBytes
max :: CNumBytes -> CNumBytes -> CNumBytes
$cmax :: CNumBytes -> CNumBytes -> CNumBytes
>= :: CNumBytes -> CNumBytes -> Bool
$c>= :: CNumBytes -> CNumBytes -> Bool
> :: CNumBytes -> CNumBytes -> Bool
$c> :: CNumBytes -> CNumBytes -> Bool
<= :: CNumBytes -> CNumBytes -> Bool
$c<= :: CNumBytes -> CNumBytes -> Bool
< :: CNumBytes -> CNumBytes -> Bool
$c< :: CNumBytes -> CNumBytes -> Bool
compare :: CNumBytes -> CNumBytes -> Ordering
$ccompare :: CNumBytes -> CNumBytes -> Ordering
$cp1Ord :: Eq CNumBytes
Ord, Int -> CNumBytes -> ShowS
[CNumBytes] -> ShowS
CNumBytes -> String
(Int -> CNumBytes -> ShowS)
-> (CNumBytes -> String)
-> ([CNumBytes] -> ShowS)
-> Show CNumBytes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CNumBytes] -> ShowS
$cshowList :: [CNumBytes] -> ShowS
show :: CNumBytes -> String
$cshow :: CNumBytes -> String
showsPrec :: Int -> CNumBytes -> ShowS
$cshowsPrec :: Int -> CNumBytes -> ShowS
Show, Int -> CNumBytes
CNumBytes -> Int
CNumBytes -> [CNumBytes]
CNumBytes -> CNumBytes
CNumBytes -> CNumBytes -> [CNumBytes]
CNumBytes -> CNumBytes -> CNumBytes -> [CNumBytes]
(CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes)
-> (Int -> CNumBytes)
-> (CNumBytes -> Int)
-> (CNumBytes -> [CNumBytes])
-> (CNumBytes -> CNumBytes -> [CNumBytes])
-> (CNumBytes -> CNumBytes -> [CNumBytes])
-> (CNumBytes -> CNumBytes -> CNumBytes -> [CNumBytes])
-> Enum CNumBytes
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: CNumBytes -> CNumBytes -> CNumBytes -> [CNumBytes]
$cenumFromThenTo :: CNumBytes -> CNumBytes -> CNumBytes -> [CNumBytes]
enumFromTo :: CNumBytes -> CNumBytes -> [CNumBytes]
$cenumFromTo :: CNumBytes -> CNumBytes -> [CNumBytes]
enumFromThen :: CNumBytes -> CNumBytes -> [CNumBytes]
$cenumFromThen :: CNumBytes -> CNumBytes -> [CNumBytes]
enumFrom :: CNumBytes -> [CNumBytes]
$cenumFrom :: CNumBytes -> [CNumBytes]
fromEnum :: CNumBytes -> Int
$cfromEnum :: CNumBytes -> Int
toEnum :: Int -> CNumBytes
$ctoEnum :: Int -> CNumBytes
pred :: CNumBytes -> CNumBytes
$cpred :: CNumBytes -> CNumBytes
succ :: CNumBytes -> CNumBytes
$csucc :: CNumBytes -> CNumBytes
Enum, Integer -> CNumBytes
CNumBytes -> CNumBytes
CNumBytes -> CNumBytes -> CNumBytes
(CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes)
-> (Integer -> CNumBytes)
-> Num CNumBytes
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> CNumBytes
$cfromInteger :: Integer -> CNumBytes
signum :: CNumBytes -> CNumBytes
$csignum :: CNumBytes -> CNumBytes
abs :: CNumBytes -> CNumBytes
$cabs :: CNumBytes -> CNumBytes
negate :: CNumBytes -> CNumBytes
$cnegate :: CNumBytes -> CNumBytes
* :: CNumBytes -> CNumBytes -> CNumBytes
$c* :: CNumBytes -> CNumBytes -> CNumBytes
- :: CNumBytes -> CNumBytes -> CNumBytes
$c- :: CNumBytes -> CNumBytes -> CNumBytes
+ :: CNumBytes -> CNumBytes -> CNumBytes
$c+ :: CNumBytes -> CNumBytes -> CNumBytes
Num, Num CNumBytes
Ord CNumBytes
Num CNumBytes
-> Ord CNumBytes -> (CNumBytes -> Rational) -> Real CNumBytes
CNumBytes -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: CNumBytes -> Rational
$ctoRational :: CNumBytes -> Rational
$cp2Real :: Ord CNumBytes
$cp1Real :: Num CNumBytes
Real, Enum CNumBytes
Real CNumBytes
Real CNumBytes
-> Enum CNumBytes
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes -> CNumBytes)
-> (CNumBytes -> CNumBytes -> (CNumBytes, CNumBytes))
-> (CNumBytes -> CNumBytes -> (CNumBytes, CNumBytes))
-> (CNumBytes -> Integer)
-> Integral CNumBytes
CNumBytes -> Integer
CNumBytes -> CNumBytes -> (CNumBytes, CNumBytes)
CNumBytes -> CNumBytes -> CNumBytes
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: CNumBytes -> Integer
$ctoInteger :: CNumBytes -> Integer
divMod :: CNumBytes -> CNumBytes -> (CNumBytes, CNumBytes)
$cdivMod :: CNumBytes -> CNumBytes -> (CNumBytes, CNumBytes)
quotRem :: CNumBytes -> CNumBytes -> (CNumBytes, CNumBytes)
$cquotRem :: CNumBytes -> CNumBytes -> (CNumBytes, CNumBytes)
mod :: CNumBytes -> CNumBytes -> CNumBytes
$cmod :: CNumBytes -> CNumBytes -> CNumBytes
div :: CNumBytes -> CNumBytes -> CNumBytes
$cdiv :: CNumBytes -> CNumBytes -> CNumBytes
rem :: CNumBytes -> CNumBytes -> CNumBytes
$crem :: CNumBytes -> CNumBytes -> CNumBytes
quot :: CNumBytes -> CNumBytes -> CNumBytes
$cquot :: CNumBytes -> CNumBytes -> CNumBytes
$cp2Integral :: Enum CNumBytes
$cp1Integral :: Real CNumBytes
Integral)

-- | <https://www.sqlite.org/c3ref/c_static.html>
--
-- @Ptr CDestructor@ = @sqlite3_destructor_type@
data CDestructor

-- | Tells SQLite3 that the content pointer is constant and will never change
c_SQLITE_STATIC :: Ptr CDestructor
c_SQLITE_STATIC :: Ptr CDestructor
c_SQLITE_STATIC = IntPtr -> Ptr CDestructor
forall a. IntPtr -> Ptr a
intPtrToPtr IntPtr
0

-- | Tells SQLite3 to make its own private copy of the data
c_SQLITE_TRANSIENT :: Ptr CDestructor
c_SQLITE_TRANSIENT :: Ptr CDestructor
c_SQLITE_TRANSIENT = IntPtr -> Ptr CDestructor
forall a. IntPtr -> Ptr a
intPtrToPtr (-IntPtr
1)

c_SQLITE_UTF8 :: CInt
c_SQLITE_UTF8 :: CInt
c_SQLITE_UTF8 = CInt
1
{-# LINE 218 "Database/SQLite3/Bindings/Types.hsc" #-}

-- | Number of arguments of a user defined SQL function.
newtype ArgCount = ArgCount Int
    deriving (ArgCount -> ArgCount -> Bool
(ArgCount -> ArgCount -> Bool)
-> (ArgCount -> ArgCount -> Bool) -> Eq ArgCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArgCount -> ArgCount -> Bool
$c/= :: ArgCount -> ArgCount -> Bool
== :: ArgCount -> ArgCount -> Bool
$c== :: ArgCount -> ArgCount -> Bool
Eq, Eq ArgCount
Eq ArgCount
-> (ArgCount -> ArgCount -> Ordering)
-> (ArgCount -> ArgCount -> Bool)
-> (ArgCount -> ArgCount -> Bool)
-> (ArgCount -> ArgCount -> Bool)
-> (ArgCount -> ArgCount -> Bool)
-> (ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount -> ArgCount)
-> Ord ArgCount
ArgCount -> ArgCount -> Bool
ArgCount -> ArgCount -> Ordering
ArgCount -> ArgCount -> ArgCount
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ArgCount -> ArgCount -> ArgCount
$cmin :: ArgCount -> ArgCount -> ArgCount
max :: ArgCount -> ArgCount -> ArgCount
$cmax :: ArgCount -> ArgCount -> ArgCount
>= :: ArgCount -> ArgCount -> Bool
$c>= :: ArgCount -> ArgCount -> Bool
> :: ArgCount -> ArgCount -> Bool
$c> :: ArgCount -> ArgCount -> Bool
<= :: ArgCount -> ArgCount -> Bool
$c<= :: ArgCount -> ArgCount -> Bool
< :: ArgCount -> ArgCount -> Bool
$c< :: ArgCount -> ArgCount -> Bool
compare :: ArgCount -> ArgCount -> Ordering
$ccompare :: ArgCount -> ArgCount -> Ordering
$cp1Ord :: Eq ArgCount
Ord, Int -> ArgCount
ArgCount -> Int
ArgCount -> [ArgCount]
ArgCount -> ArgCount
ArgCount -> ArgCount -> [ArgCount]
ArgCount -> ArgCount -> ArgCount -> [ArgCount]
(ArgCount -> ArgCount)
-> (ArgCount -> ArgCount)
-> (Int -> ArgCount)
-> (ArgCount -> Int)
-> (ArgCount -> [ArgCount])
-> (ArgCount -> ArgCount -> [ArgCount])
-> (ArgCount -> ArgCount -> [ArgCount])
-> (ArgCount -> ArgCount -> ArgCount -> [ArgCount])
-> Enum ArgCount
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ArgCount -> ArgCount -> ArgCount -> [ArgCount]
$cenumFromThenTo :: ArgCount -> ArgCount -> ArgCount -> [ArgCount]
enumFromTo :: ArgCount -> ArgCount -> [ArgCount]
$cenumFromTo :: ArgCount -> ArgCount -> [ArgCount]
enumFromThen :: ArgCount -> ArgCount -> [ArgCount]
$cenumFromThen :: ArgCount -> ArgCount -> [ArgCount]
enumFrom :: ArgCount -> [ArgCount]
$cenumFrom :: ArgCount -> [ArgCount]
fromEnum :: ArgCount -> Int
$cfromEnum :: ArgCount -> Int
toEnum :: Int -> ArgCount
$ctoEnum :: Int -> ArgCount
pred :: ArgCount -> ArgCount
$cpred :: ArgCount -> ArgCount
succ :: ArgCount -> ArgCount
$csucc :: ArgCount -> ArgCount
Enum, Integer -> ArgCount
ArgCount -> ArgCount
ArgCount -> ArgCount -> ArgCount
(ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount)
-> (ArgCount -> ArgCount)
-> (ArgCount -> ArgCount)
-> (Integer -> ArgCount)
-> Num ArgCount
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> ArgCount
$cfromInteger :: Integer -> ArgCount
signum :: ArgCount -> ArgCount
$csignum :: ArgCount -> ArgCount
abs :: ArgCount -> ArgCount
$cabs :: ArgCount -> ArgCount
negate :: ArgCount -> ArgCount
$cnegate :: ArgCount -> ArgCount
* :: ArgCount -> ArgCount -> ArgCount
$c* :: ArgCount -> ArgCount -> ArgCount
- :: ArgCount -> ArgCount -> ArgCount
$c- :: ArgCount -> ArgCount -> ArgCount
+ :: ArgCount -> ArgCount -> ArgCount
$c+ :: ArgCount -> ArgCount -> ArgCount
Num, Num ArgCount
Ord ArgCount
Num ArgCount
-> Ord ArgCount -> (ArgCount -> Rational) -> Real ArgCount
ArgCount -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: ArgCount -> Rational
$ctoRational :: ArgCount -> Rational
$cp2Real :: Ord ArgCount
$cp1Real :: Num ArgCount
Real, Enum ArgCount
Real ArgCount
Real ArgCount
-> Enum ArgCount
-> (ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount -> ArgCount)
-> (ArgCount -> ArgCount -> (ArgCount, ArgCount))
-> (ArgCount -> ArgCount -> (ArgCount, ArgCount))
-> (ArgCount -> Integer)
-> Integral ArgCount
ArgCount -> Integer
ArgCount -> ArgCount -> (ArgCount, ArgCount)
ArgCount -> ArgCount -> ArgCount
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: ArgCount -> Integer
$ctoInteger :: ArgCount -> Integer
divMod :: ArgCount -> ArgCount -> (ArgCount, ArgCount)
$cdivMod :: ArgCount -> ArgCount -> (ArgCount, ArgCount)
quotRem :: ArgCount -> ArgCount -> (ArgCount, ArgCount)
$cquotRem :: ArgCount -> ArgCount -> (ArgCount, ArgCount)
mod :: ArgCount -> ArgCount -> ArgCount
$cmod :: ArgCount -> ArgCount -> ArgCount
div :: ArgCount -> ArgCount -> ArgCount
$cdiv :: ArgCount -> ArgCount -> ArgCount
rem :: ArgCount -> ArgCount -> ArgCount
$crem :: ArgCount -> ArgCount -> ArgCount
quot :: ArgCount -> ArgCount -> ArgCount
$cquot :: ArgCount -> ArgCount -> ArgCount
$cp2Integral :: Enum ArgCount
$cp1Integral :: Real ArgCount
Integral)

-- | This just shows the underlying integer, without the data constructor.
instance Show ArgCount where
    show :: ArgCount -> String
show (ArgCount Int
n) = Int -> String
forall a. Show a => a -> String
show Int
n

instance Bounded ArgCount where
    minBound :: ArgCount
minBound = Int -> ArgCount
ArgCount Int
0
    maxBound :: ArgCount
maxBound = Int -> ArgCount
ArgCount (Int
6)
{-# LINE 230 "Database/SQLite3/Bindings/Types.hsc" #-}

-- | Index of an argument to a custom function. Indices start from 0.
type ArgIndex = ArgCount

newtype CArgCount = CArgCount CInt
    deriving (CArgCount -> CArgCount -> Bool
(CArgCount -> CArgCount -> Bool)
-> (CArgCount -> CArgCount -> Bool) -> Eq CArgCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CArgCount -> CArgCount -> Bool
$c/= :: CArgCount -> CArgCount -> Bool
== :: CArgCount -> CArgCount -> Bool
$c== :: CArgCount -> CArgCount -> Bool
Eq, Eq CArgCount
Eq CArgCount
-> (CArgCount -> CArgCount -> Ordering)
-> (CArgCount -> CArgCount -> Bool)
-> (CArgCount -> CArgCount -> Bool)
-> (CArgCount -> CArgCount -> Bool)
-> (CArgCount -> CArgCount -> Bool)
-> (CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount -> CArgCount)
-> Ord CArgCount
CArgCount -> CArgCount -> Bool
CArgCount -> CArgCount -> Ordering
CArgCount -> CArgCount -> CArgCount
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CArgCount -> CArgCount -> CArgCount
$cmin :: CArgCount -> CArgCount -> CArgCount
max :: CArgCount -> CArgCount -> CArgCount
$cmax :: CArgCount -> CArgCount -> CArgCount
>= :: CArgCount -> CArgCount -> Bool
$c>= :: CArgCount -> CArgCount -> Bool
> :: CArgCount -> CArgCount -> Bool
$c> :: CArgCount -> CArgCount -> Bool
<= :: CArgCount -> CArgCount -> Bool
$c<= :: CArgCount -> CArgCount -> Bool
< :: CArgCount -> CArgCount -> Bool
$c< :: CArgCount -> CArgCount -> Bool
compare :: CArgCount -> CArgCount -> Ordering
$ccompare :: CArgCount -> CArgCount -> Ordering
$cp1Ord :: Eq CArgCount
Ord, Int -> CArgCount
CArgCount -> Int
CArgCount -> [CArgCount]
CArgCount -> CArgCount
CArgCount -> CArgCount -> [CArgCount]
CArgCount -> CArgCount -> CArgCount -> [CArgCount]
(CArgCount -> CArgCount)
-> (CArgCount -> CArgCount)
-> (Int -> CArgCount)
-> (CArgCount -> Int)
-> (CArgCount -> [CArgCount])
-> (CArgCount -> CArgCount -> [CArgCount])
-> (CArgCount -> CArgCount -> [CArgCount])
-> (CArgCount -> CArgCount -> CArgCount -> [CArgCount])
-> Enum CArgCount
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: CArgCount -> CArgCount -> CArgCount -> [CArgCount]
$cenumFromThenTo :: CArgCount -> CArgCount -> CArgCount -> [CArgCount]
enumFromTo :: CArgCount -> CArgCount -> [CArgCount]
$cenumFromTo :: CArgCount -> CArgCount -> [CArgCount]
enumFromThen :: CArgCount -> CArgCount -> [CArgCount]
$cenumFromThen :: CArgCount -> CArgCount -> [CArgCount]
enumFrom :: CArgCount -> [CArgCount]
$cenumFrom :: CArgCount -> [CArgCount]
fromEnum :: CArgCount -> Int
$cfromEnum :: CArgCount -> Int
toEnum :: Int -> CArgCount
$ctoEnum :: Int -> CArgCount
pred :: CArgCount -> CArgCount
$cpred :: CArgCount -> CArgCount
succ :: CArgCount -> CArgCount
$csucc :: CArgCount -> CArgCount
Enum, Integer -> CArgCount
CArgCount -> CArgCount
CArgCount -> CArgCount -> CArgCount
(CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount)
-> (CArgCount -> CArgCount)
-> (CArgCount -> CArgCount)
-> (Integer -> CArgCount)
-> Num CArgCount
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> CArgCount
$cfromInteger :: Integer -> CArgCount
signum :: CArgCount -> CArgCount
$csignum :: CArgCount -> CArgCount
abs :: CArgCount -> CArgCount
$cabs :: CArgCount -> CArgCount
negate :: CArgCount -> CArgCount
$cnegate :: CArgCount -> CArgCount
* :: CArgCount -> CArgCount -> CArgCount
$c* :: CArgCount -> CArgCount -> CArgCount
- :: CArgCount -> CArgCount -> CArgCount
$c- :: CArgCount -> CArgCount -> CArgCount
+ :: CArgCount -> CArgCount -> CArgCount
$c+ :: CArgCount -> CArgCount -> CArgCount
Num, Num CArgCount
Ord CArgCount
Num CArgCount
-> Ord CArgCount -> (CArgCount -> Rational) -> Real CArgCount
CArgCount -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: CArgCount -> Rational
$ctoRational :: CArgCount -> Rational
$cp2Real :: Ord CArgCount
$cp1Real :: Num CArgCount
Real, Enum CArgCount
Real CArgCount
Real CArgCount
-> Enum CArgCount
-> (CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount -> CArgCount)
-> (CArgCount -> CArgCount -> (CArgCount, CArgCount))
-> (CArgCount -> CArgCount -> (CArgCount, CArgCount))
-> (CArgCount -> Integer)
-> Integral CArgCount
CArgCount -> Integer
CArgCount -> CArgCount -> (CArgCount, CArgCount)
CArgCount -> CArgCount -> CArgCount
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: CArgCount -> Integer
$ctoInteger :: CArgCount -> Integer
divMod :: CArgCount -> CArgCount -> (CArgCount, CArgCount)
$cdivMod :: CArgCount -> CArgCount -> (CArgCount, CArgCount)
quotRem :: CArgCount -> CArgCount -> (CArgCount, CArgCount)
$cquotRem :: CArgCount -> CArgCount -> (CArgCount, CArgCount)
mod :: CArgCount -> CArgCount -> CArgCount
$cmod :: CArgCount -> CArgCount -> CArgCount
div :: CArgCount -> CArgCount -> CArgCount
$cdiv :: CArgCount -> CArgCount -> CArgCount
rem :: CArgCount -> CArgCount -> CArgCount
$crem :: CArgCount -> CArgCount -> CArgCount
quot :: CArgCount -> CArgCount -> CArgCount
$cquot :: CArgCount -> CArgCount -> CArgCount
$cp2Integral :: Enum CArgCount
$cp1Integral :: Real CArgCount
Integral)

-- | This just shows the underlying integer, without the data constructor.
instance Show CArgCount where
    show :: CArgCount -> String
show (CArgCount CInt
n) = CInt -> String
forall a. Show a => a -> String
show CInt
n

instance Bounded CArgCount where
    minBound :: CArgCount
minBound = CInt -> CArgCount
CArgCount (-CInt
1)
    maxBound :: CArgCount
maxBound = CInt -> CArgCount
CArgCount CInt
6
{-# LINE 244 "Database/SQLite3/Bindings/Types.hsc" #-}

-- | Tells SQLite3 that the defined custom SQL function is deterministic.
c_SQLITE_DETERMINISTIC :: CInt
c_SQLITE_DETERMINISTIC :: CInt
c_SQLITE_DETERMINISTIC = CInt
2048
{-# LINE 248 "Database/SQLite3/Bindings/Types.hsc" #-}

-- | <https://www.sqlite.org/c3ref/c_abort.html>
newtype CError = CError CInt
    deriving (CError -> CError -> Bool
(CError -> CError -> Bool)
-> (CError -> CError -> Bool) -> Eq CError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CError -> CError -> Bool
$c/= :: CError -> CError -> Bool
== :: CError -> CError -> Bool
$c== :: CError -> CError -> Bool
Eq, Int -> CError -> ShowS
[CError] -> ShowS
CError -> String
(Int -> CError -> ShowS)
-> (CError -> String) -> ([CError] -> ShowS) -> Show CError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CError] -> ShowS
$cshowList :: [CError] -> ShowS
show :: CError -> String
$cshow :: CError -> String
showsPrec :: Int -> CError -> ShowS
$cshowsPrec :: Int -> CError -> ShowS
Show)

-- | 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.
decodeError :: CError -> Error
decodeError :: CError -> Error
decodeError (CError CInt
n) = case CInt
n of
    CInt
0         -> Error
ErrorOK
{-# LINE 266 "Database/SQLite3/Bindings/Types.hsc" #-}
    1      -> ErrorError
{-# LINE 267 "Database/SQLite3/Bindings/Types.hsc" #-}
    2   -> ErrorInternal
{-# LINE 268 "Database/SQLite3/Bindings/Types.hsc" #-}
    3       -> ErrorPermission
{-# LINE 269 "Database/SQLite3/Bindings/Types.hsc" #-}
    4      -> ErrorAbort
{-# LINE 270 "Database/SQLite3/Bindings/Types.hsc" #-}
    5       -> ErrorBusy
{-# LINE 271 "Database/SQLite3/Bindings/Types.hsc" #-}
    6     -> ErrorLocked
{-# LINE 272 "Database/SQLite3/Bindings/Types.hsc" #-}
    7      -> ErrorNoMemory
{-# LINE 273 "Database/SQLite3/Bindings/Types.hsc" #-}
    8   -> ErrorReadOnly
{-# LINE 274 "Database/SQLite3/Bindings/Types.hsc" #-}
    9  -> ErrorInterrupt
{-# LINE 275 "Database/SQLite3/Bindings/Types.hsc" #-}
    10      -> ErrorIO
{-# LINE 276 "Database/SQLite3/Bindings/Types.hsc" #-}
    11    -> ErrorCorrupt
{-# LINE 277 "Database/SQLite3/Bindings/Types.hsc" #-}
    12   -> ErrorNotFound
{-# LINE 278 "Database/SQLite3/Bindings/Types.hsc" #-}
    13       -> ErrorFull
{-# LINE 279 "Database/SQLite3/Bindings/Types.hsc" #-}
    14   -> ErrorCan'tOpen
{-# LINE 280 "Database/SQLite3/Bindings/Types.hsc" #-}
    15   -> ErrorProtocol
{-# LINE 281 "Database/SQLite3/Bindings/Types.hsc" #-}
    16      -> ErrorEmpty
{-# LINE 282 "Database/SQLite3/Bindings/Types.hsc" #-}
    17     -> ErrorSchema
{-# LINE 283 "Database/SQLite3/Bindings/Types.hsc" #-}
    18     -> ErrorTooBig
{-# LINE 284 "Database/SQLite3/Bindings/Types.hsc" #-}
    19 -> ErrorConstraint
{-# LINE 285 "Database/SQLite3/Bindings/Types.hsc" #-}
    20   -> ErrorMismatch
{-# LINE 286 "Database/SQLite3/Bindings/Types.hsc" #-}
    21     -> ErrorMisuse
{-# LINE 287 "Database/SQLite3/Bindings/Types.hsc" #-}
    22      -> ErrorNoLargeFileSupport
{-# LINE 288 "Database/SQLite3/Bindings/Types.hsc" #-}
    23       -> ErrorAuthorization
{-# LINE 289 "Database/SQLite3/Bindings/Types.hsc" #-}
    24     -> ErrorFormat
{-# LINE 290 "Database/SQLite3/Bindings/Types.hsc" #-}
    25      -> ErrorRange
{-# LINE 291 "Database/SQLite3/Bindings/Types.hsc" #-}
    26     -> ErrorNotADatabase
{-# LINE 292 "Database/SQLite3/Bindings/Types.hsc" #-}
    27     -> ErrorNotice
{-# LINE 293 "Database/SQLite3/Bindings/Types.hsc" #-}
    28    -> ErrorWarning
{-# LINE 294 "Database/SQLite3/Bindings/Types.hsc" #-}
    100        -> ErrorRow
{-# LINE 295 "Database/SQLite3/Bindings/Types.hsc" #-}
    101       -> ErrorDone
{-# LINE 296 "Database/SQLite3/Bindings/Types.hsc" #-}
    _                          -> error $ "decodeError " ++ show n

encodeError :: Error -> CError
encodeError :: Error -> CError
encodeError Error
err = CInt -> CError
CError (CInt -> CError) -> CInt -> CError
forall a b. (a -> b) -> a -> b
$ case Error
err of
    Error
ErrorOK                 -> CInt
0
{-# LINE 301 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorError              -> 1
{-# LINE 302 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorInternal           -> 2
{-# LINE 303 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorPermission         -> 3
{-# LINE 304 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorAbort              -> 4
{-# LINE 305 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorBusy               -> 5
{-# LINE 306 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorLocked             -> 6
{-# LINE 307 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorNoMemory           -> 7
{-# LINE 308 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorReadOnly           -> 8
{-# LINE 309 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorInterrupt          -> 9
{-# LINE 310 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorIO                 -> 10
{-# LINE 311 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorCorrupt            -> 11
{-# LINE 312 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorNotFound           -> 12
{-# LINE 313 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorFull               -> 13
{-# LINE 314 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorCan'tOpen          -> 14
{-# LINE 315 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorProtocol           -> 15
{-# LINE 316 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorEmpty              -> 16
{-# LINE 317 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorSchema             -> 17
{-# LINE 318 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorTooBig             -> 18
{-# LINE 319 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorConstraint         -> 19
{-# LINE 320 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorMismatch           -> 20
{-# LINE 321 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorMisuse             -> 21
{-# LINE 322 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorNoLargeFileSupport -> 22
{-# LINE 323 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorAuthorization      -> 23
{-# LINE 324 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorFormat             -> 24
{-# LINE 325 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorRange              -> 25
{-# LINE 326 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorNotADatabase       -> 26
{-# LINE 327 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorNotice             -> 27
{-# LINE 328 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorWarning            -> 28
{-# LINE 329 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorRow                -> 100
{-# LINE 330 "Database/SQLite3/Bindings/Types.hsc" #-}
    ErrorDone               -> 101
{-# LINE 331 "Database/SQLite3/Bindings/Types.hsc" #-}

-- | <https://www.sqlite.org/c3ref/c_blob.html>
newtype CColumnType = CColumnType CInt
    deriving (CColumnType -> CColumnType -> Bool
(CColumnType -> CColumnType -> Bool)
-> (CColumnType -> CColumnType -> Bool) -> Eq CColumnType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CColumnType -> CColumnType -> Bool
$c/= :: CColumnType -> CColumnType -> Bool
== :: CColumnType -> CColumnType -> Bool
$c== :: CColumnType -> CColumnType -> Bool
Eq, Int -> CColumnType -> ShowS
[CColumnType] -> ShowS
CColumnType -> String
(Int -> CColumnType -> ShowS)
-> (CColumnType -> String)
-> ([CColumnType] -> ShowS)
-> Show CColumnType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CColumnType] -> ShowS
$cshowList :: [CColumnType] -> ShowS
show :: CColumnType -> String
$cshow :: CColumnType -> String
showsPrec :: Int -> CColumnType -> ShowS
$cshowsPrec :: Int -> CColumnType -> ShowS
Show)

-- | Note that this is a partial function.
-- See 'decodeError' for more information.
decodeColumnType :: CColumnType -> ColumnType
decodeColumnType :: CColumnType -> ColumnType
decodeColumnType (CColumnType CInt
n) = case CInt
n of
    CInt
1 -> ColumnType
IntegerColumn
{-# LINE 341 "Database/SQLite3/Bindings/Types.hsc" #-}
    2   -> FloatColumn
{-# LINE 342 "Database/SQLite3/Bindings/Types.hsc" #-}
    3    -> TextColumn
{-# LINE 343 "Database/SQLite3/Bindings/Types.hsc" #-}
    4    -> BlobColumn
{-# LINE 344 "Database/SQLite3/Bindings/Types.hsc" #-}
    5    -> NullColumn
{-# LINE 345 "Database/SQLite3/Bindings/Types.hsc" #-}
    _                       -> error $ "decodeColumnType " ++ show n

encodeColumnType :: ColumnType -> CColumnType
encodeColumnType :: ColumnType -> CColumnType
encodeColumnType ColumnType
t = CInt -> CColumnType
CColumnType (CInt -> CColumnType) -> CInt -> CColumnType
forall a b. (a -> b) -> a -> b
$ case ColumnType
t of
    ColumnType
IntegerColumn -> CInt
1
{-# LINE 350 "Database/SQLite3/Bindings/Types.hsc" #-}
    FloatColumn   -> 2
{-# LINE 351 "Database/SQLite3/Bindings/Types.hsc" #-}
    TextColumn    -> 3
{-# LINE 352 "Database/SQLite3/Bindings/Types.hsc" #-}
    BlobColumn    -> 4
{-# LINE 353 "Database/SQLite3/Bindings/Types.hsc" #-}
    NullColumn    -> 5
{-# LINE 354 "Database/SQLite3/Bindings/Types.hsc" #-}

------------------------------------------------------------------------
-- Conversion to and from FFI types

-- | 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.
class FFIType public ffi | public -> ffi, ffi -> public where
    toFFI   :: public -> ffi
    fromFFI :: ffi -> public

instance FFIType ParamIndex CParamIndex where
    toFFI :: ParamIndex -> CParamIndex
toFFI (ParamIndex Int
n) = CInt -> CParamIndex
CParamIndex (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)
    fromFFI :: CParamIndex -> ParamIndex
fromFFI (CParamIndex CInt
n) = Int -> ParamIndex
ParamIndex (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
n)

instance FFIType ColumnIndex CColumnIndex where
    toFFI :: ColumnIndex -> CColumnIndex
toFFI (ColumnIndex Int
n) = CInt -> CColumnIndex
CColumnIndex (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)
    fromFFI :: CColumnIndex -> ColumnIndex
fromFFI (CColumnIndex CInt
n) = Int -> ColumnIndex
ColumnIndex (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
n)

instance FFIType Error CError where
    toFFI :: Error -> CError
toFFI = Error -> CError
encodeError
    fromFFI :: CError -> Error
fromFFI = CError -> Error
decodeError

instance FFIType ColumnType CColumnType where
    toFFI :: ColumnType -> CColumnType
toFFI = ColumnType -> CColumnType
encodeColumnType
    fromFFI :: CColumnType -> ColumnType
fromFFI = CColumnType -> ColumnType
decodeColumnType

instance FFIType ArgCount CArgCount where
    toFFI :: ArgCount -> CArgCount
toFFI (ArgCount Int
n)  = CInt -> CArgCount
CArgCount (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)
    fromFFI :: CArgCount -> ArgCount
fromFFI (CArgCount CInt
n) = Int -> ArgCount
ArgCount (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
n)