-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Statically checked database access
--
-- Using Template Haskell and HDBC to do statically checked database
-- access.
@package MetaHDBC
@version 0.1.4
module Database.MetaHDBC.OdbcInferTypes
-- | Asks a ODBC database to infer selected types and placeholder types.
dbInferTypes :: String -> String -> IO ([SqlColDesc], [SqlColDesc])
strictList :: [a] -> IO [a]
module Database.MetaHDBC.Connection
type HashTable k v = BasicHashTable k v
data CachingConnection
CachingConnection :: Connection -> MVar (HashTable String Statement) -> CachingConnection
hdbcConnection :: CachingConnection -> Connection
statementMap :: CachingConnection -> MVar (HashTable String Statement)
cachingConnection :: String -> IO CachingConnection
cachingPrepare :: CachingConnection -> String -> IO Statement
module Database.MetaHDBC.SqlTypeIdExpQ
-- | Given a SqlTypeId it returns a function f which transforms a
-- SqlValue into another type. The return type of f is dependent upon the
-- value of SqlTypeId. The function f is encapsulated in an
-- ExpQ. Also see toSqlTypeId.
fromSqlTypeId :: SqlTypeId -> ExpQ
-- | The opposite of fromSqlTypeId in that it returns a function
-- from a type to SqlValue. Similarly the function is returned in
-- a ExpQ. See fromSqlTypeId.
toSqlTypeId :: SqlTypeId -> ExpQ
-- | Like fromSqlTypeId but also considers if the SqlValue is
-- nullable.
fromSqlColDesc :: SqlColDesc -> ExpQ
-- | Like toSqlTypeId but also considers if the SqlValue is
-- nullable.
toSqlColDesc :: SqlColDesc -> ExpQ
module Database.MetaHDBC.SimpleSqlParser
-- | Parses an extended SQL string. The extionsion is that we allow
-- variable-ids after placeholders (question marks). We return the list
-- of identifiers and the SQL string without the variable-ids. If no
-- variable-id is found after a placeholder, the empty string is returned
-- as variable-id.
simpleSqlParser :: String -> ([String], String)
module Database.MetaHDBC.SqlExpr
-- | Statically typed one-off (not prepared) SQL statement.
runStmt :: String -> String -> ExpQ
-- | Statically typed prepared SQL statement.
prepareStmt :: String -> String -> ExpQ
-- | Makes the query result from prepareStmt or runStmt strict.
strict :: IO [a] -> IO [a]
-- | Common parts for both statements run directly (runStmt) and prepared
-- statements.
data ExprParts
ExprParts :: [Parameter] -> [SqlColDesc] -> String -> Name -> ExprParts
-- | Positional parameters
parameters :: ExprParts -> [Parameter]
-- | Description of values returned from a SQL statement
returnTypes :: ExprParts -> [SqlColDesc]
-- | The SQL expression which is passed on to the database
dbSqlExpr :: ExprParts -> String
-- | Name of the Connection parameter.
connectionName :: ExprParts -> Name
-- | Describing a positional parameter
data Parameter
Parameter :: Name -> SqlColDesc -> Bool -> Parameter
parmName :: Parameter -> Name
typeID :: Parameter -> SqlColDesc
isBound :: Parameter -> Bool
-- | Parts used in prepared statements
data PrepareParts
PrepareParts :: ExprParts -> Name -> PrepareParts
exprParts :: PrepareParts -> ExprParts
stmtName :: PrepareParts -> Name
rethrowDoing :: IO a -> String -> IO a
-- | Returns textual information about a query. The returned String
-- is useful as presentation to a user, not for further processing.
sqlInfo :: String -> String -> IO String
-- | Contructs expression-parts. A database is contacted to parse the SQL
-- and infer correct types.
makeExprParts :: String -> String -> Q ExprParts
-- | Constructs a lambda which given a connection and parameters will
-- execute expr. See runStmtRHS.
runStmtLHS :: ExprParts -> ExpQ -> ExpQ
-- | Creates an exprresion which runs a SQL statement on a database server.
-- It is expected that the connection variable and parameters has already
-- been bound. See also runStmtLHS.
runStmtRHS :: ExprParts -> ExpQ
-- | Creates parts for a prepared statement. Calls makeExprParts.
makePrepStmtParts :: String -> String -> Q PrepareParts
-- | Lambda for prepared statements.
prepStmtLHS :: PrepareParts -> [StmtQ] -> ExpQ
-- | A StmtQ which prepares a statement on a database.
prepStmtQ :: PrepareParts -> StmtQ
-- | A StmtQ to execute a statement on a database.
execPrepStmtRHS :: PrepareParts -> StmtQ
-- | Creates a StmtQ of type: IO (a1-an -> IO ... ). Where a1-an are the
-- parameters which must be bound.
returnExecPrepStmtLHS :: PrepareParts -> [StmtQ] -> StmtQ
runStmtML :: String -> QuasiQuoter
multiline :: QuasiQuoter
-- | Re-exports MetaHDBC modules and a little part HDBC.ODBC.
module Database.MetaHDBC
cachingConnection :: String -> IO CachingConnection
-- | Disconnect from the remote database.
--
-- You do not need to explicitly close an IConnection object, but you may
-- do so if you so desire. If you don't, the object will disconnect from
-- the database in a sane way when it is garbage-collected. However, a
-- disconnection may raise an error, so you are encouraged to explicitly
-- call disconnect. Also, garbage collection may not run when the
-- program terminates, and some databases really like an explicit
-- disconnect.
--
-- So, bottom line is, you're best off calling disconnect
-- directly, but the world won't end if you forget.
--
-- This function discards any data not committed already. Database driver
-- implementators should explicitly call rollback if their
-- databases don't do this automatically on disconnect.
--
-- Bad Things (TM) could happen if you call this while you have
-- Statements active. In more precise language, the results in
-- such situations are undefined and vary by database. So don't do it.
disconnect :: IConnection conn => conn -> IO ()
-- | Commit any pending data to the database.
--
-- Required to make any changes take effect.
commit :: IConnection conn => conn -> IO ()
-- | Roll back to the state the database was in prior to the last
-- commit or rollback.
rollback :: IConnection conn => conn -> IO ()
connectODBC :: String -> IO Connection
data Connection :: *