haskelldb-2.2.2: A library of combinators for generating and executing SQL statements.

Portabilityportable
Stabilityexperimental
Maintainerchucky@dtek.chalmers.se
Safe HaskellNone

Database.HaskellDB.DriverAPI

Description

This exports an API that all drivers must conform to. It is used by the end user to load drivers either dynamically or statically.

Synopsis

Documentation

data DriverInterface Source

Interface which drivers should implement. The connect function takes some driver specific name, value pairs use to setup the database connection, and a database action to run. requiredOptions lists all required options with a short description, that is printed as help in the DBDirect program.

Constructors

DriverInterface 

Fields

connect :: forall m a. MonadIO m => [(String, String)] -> (Database -> m a) -> m a
 
requiredOptions :: [(String, String)]
 

class Monad m => MonadIO m

Monads in which IO computations may be embedded. Any monad built by applying a sequence of monad transformers to the IO monad will be an instance of this class.

Instances should satisfy the following laws, which state that liftIO is a transformer of monads:

Instances

MonadIO IO 
(Monad (ErrorT e m), Error e, MonadIO m) => MonadIO (ErrorT e m) 

defaultdriver :: DriverInterfaceSource

Default dummy driver, real drivers should overload this

getOptionsSource

Arguments

:: Monad m 
=> [String]

names of options to get

-> [(String, String)]

options given

-> m [String]

a list of the same length as the first argument with the values of each option. Fails in the given monad if any options is not found.

Can be used by drivers to get option values from the given list of name, value pairs.

getAnnotatedOptionsSource

Arguments

:: Monad m 
=> [(String, String)]

names and descriptions of options to get

-> [(String, String)]

options given

-> m [String]

a list of the same length as the first argument with the values of each option. Fails in the given monad if any options is not found.

Can be used by drivers to get option values from the given list of name, value pairs. It is intended for use with the requiredOptions value of the driver.

getGeneratorSource

Arguments

:: Monad m 
=> [(String, String)]

options given

-> m SqlGenerator

An SQL generator. If there was no generator option, the default is used. Fails if the generator is unknown

Gets an SqlGenerator from the generator option in the given list. Currently available generators: mysql, postgresql, sqlite, default