Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype ConnectionString = ConnectionString {}
- createSqlitePool :: ConnectionString -> IO (Pool Database)
- withDb :: ConnectionString -> (Database -> IO a) -> IO a
- newtype SQL = SQL {}
- run :: SQL -> Database -> IO [[SQLData]]
- runWith :: SQL -> [SQLData] -> Database -> IO [[SQLData]]
- fetchAll :: Statement -> IO [[SQLData]]
- asTransaction :: Typeable a => Database -> IO a -> IO a
- asTransaction' :: Database -> IO a -> IO a
- cancelTransaction :: Typeable a => a -> IO a
- data CancelTransaction a = CancelTransaction a
Connection
newtype ConnectionString Source #
A SQLite3 connection string
Instances
IsString ConnectionString Source # | |
Defined in Database.Sqlite.Easy.Internal fromString :: String -> ConnectionString # | |
Show ConnectionString Source # | |
Defined in Database.Sqlite.Easy.Internal showsPrec :: Int -> ConnectionString -> ShowS # show :: ConnectionString -> String # showList :: [ConnectionString] -> ShowS # |
createSqlitePool :: ConnectionString -> IO (Pool Database) Source #
Create a pool of a sqlite3 db with a specific connection string.
withDb :: ConnectionString -> (Database -> IO a) -> IO a Source #
Open a database, run some stuff, close the database.
Execution
A SQL statement
run :: SQL -> Database -> IO [[SQLData]] Source #
Run a SQL statement on a database and fetch the results.
runWith :: SQL -> [SQLData] -> Database -> IO [[SQLData]] Source #
Run a SQL statement with certain parameters on a database and fetch the results.
Transaction
asTransaction :: Typeable a => Database -> IO a -> IO a Source #
Run operations as a transaction. If the action throws an error, the transaction is rolled back.
Note: Transactions do not nest.
For more information, visit: https://www.sqlite.org/lang_transaction.html
cancelTransaction :: Typeable a => a -> IO a Source #
Cancel a transaction by supplying the return value. To be used inside transactions.
data CancelTransaction a Source #
Instances
Typeable a => Exception (CancelTransaction a) Source # | |
Defined in Database.Sqlite.Easy.Internal toException :: CancelTransaction a -> SomeException # fromException :: SomeException -> Maybe (CancelTransaction a) # displayException :: CancelTransaction a -> String # | |
Show (CancelTransaction a) Source # | |
Defined in Database.Sqlite.Easy.Internal showsPrec :: Int -> CancelTransaction a -> ShowS # show :: CancelTransaction a -> String # showList :: [CancelTransaction a] -> ShowS # |