Safe Haskell | None |
---|---|
Language | Haskell98 |
- runStmt :: String -> String -> ExpQ
- prepareStmt :: String -> String -> ExpQ
- strict :: IO [a] -> IO [a]
- data ExprParts = ExprParts {
- parameters :: [Parameter]
- returnTypes :: [SqlColDesc]
- dbSqlExpr :: String
- connectionName :: Name
- data Parameter = Parameter {}
- data PrepareParts = PrepareParts {}
- rethrowDoing :: IO a -> String -> IO a
- sqlInfo :: String -> String -> IO String
- makeExprParts :: String -> String -> Q ExprParts
- runStmtLHS :: ExprParts -> ExpQ -> ExpQ
- runStmtRHS :: ExprParts -> ExpQ
- makePrepStmtParts :: String -> String -> Q PrepareParts
- prepStmtLHS :: PrepareParts -> [StmtQ] -> ExpQ
- prepStmtQ :: PrepareParts -> StmtQ
- execPrepStmtRHS :: PrepareParts -> StmtQ
- returnExecPrepStmtLHS :: PrepareParts -> [StmtQ] -> StmtQ
- runStmtML :: String -> QuasiQuoter
- multiline :: QuasiQuoter
Documentation
:: String | Data source name (DSN) |
-> String | SQL statement extended with question marks for parameteres |
-> ExpQ | The expression has type Connection -> a1 -> ... -> an -> IO [x1, ... xm]), where a1-an are inputs to the statement (due to placeholder arguments), and x1-xm are the outputs from the statement. If there are no outputs from the statement (e.g. an insert statement) the number of affected rows is returned. |
Statically typed one-off (not prepared) SQL statement.
:: String | Data source name (DSN) |
-> String | SQL statement extended with question marks for parameteres |
-> ExpQ | The expression has type Connection -> IO (a1 -> ... -> an -> IO [x1, ... xm]), where a1-an are inputs to the statement (due to placeholder arguments), and x1-xm are the outputs from the statement. If there are no outputs from the statement (e.g. an insert statement) the number of affected rows is returned. |
Statically typed prepared SQL statement.
Common parts for both statements run directly (runStmt) and prepared statements.
ExprParts | |
|
Describing a positional parameter
data PrepareParts Source
Parts used in prepared statements
rethrowDoing :: IO a -> String -> IO a Source
sqlInfo :: String -> String -> IO String Source
Returns textual information about a query. The returned String
is useful as presentation to a user, not for further processing.
makeExprParts :: String -> String -> Q ExprParts Source
Contructs expression-parts. A database is contacted to parse the SQL and infer correct types.
Helper functions to construct directly runned statements (runStmt)
Constructs a lambda which given a connection and parameters will
execute expr
. See runStmtRHS
.
runStmtRHS :: ExprParts -> ExpQ Source
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
.
Helper function to construct prepared statements
makePrepStmtParts :: String -> String -> Q PrepareParts Source
Creates parts for a prepared statement. Calls makeExprParts
.
prepStmtLHS :: PrepareParts -> [StmtQ] -> ExpQ Source
Lambda for prepared statements.
prepStmtQ :: PrepareParts -> StmtQ Source
A StmtQ which prepares a statement on a database.
execPrepStmtRHS :: PrepareParts -> StmtQ Source
A StmtQ to execute a statement on a database.
returnExecPrepStmtLHS :: PrepareParts -> [StmtQ] -> StmtQ Source
Creates a StmtQ of type: IO (a1-an -> IO ... ). Where a1-an are the parameters which must be bound.
Multiline quasi quotation
runStmtML :: String -> QuasiQuoter Source