|
| Database.MetaHDBC.SqlExpr |
|
|
|
|
|
| Synopsis |
|
|
|
| Documentation |
|
| runStmt |
| :: 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.
|
|
|
| prepareStmt |
| :: 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.
|
|
|
| strict :: IO [a] -> IO [a] |
| Makes the query result from prepareStmt or runStmt strict.
|
|
| data ExprParts |
| Common parts for both statements run directly (runStmt) and
prepared statements.
| | Constructors | | ExprParts | | | parameters :: [Parameter] | Positional parameters
| | returnTypes :: [SqlColDesc] | Description of values returned from a SQL statement
| | dbSqlExpr :: String | The SQL expression which is passed on to the database
| | connectionName :: Name | Name of the Connection parameter.
|
|
|
|
|
| data Parameter |
| Describing a positional parameter
| | Constructors | | Parameter | | | parmName :: Name | | | typeID :: SqlColDesc | | | isBound :: Bool | |
|
|
|
|
| data PrepareParts |
| Parts used in prepared statements
| | Constructors | |
|
|
| rethrowDoing :: IO a -> String -> IO a |
|
| sqlInfo :: String -> String -> IO String |
| 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 |
| Contructs expression-parts. A database is contacting to parse the
SQL and infer correct types.
|
|
| Helper functions to construct directly runned statements (runStmt)
|
|
| runStmtLHS |
| :: ExprParts | | | -> ExpQ | Expression which is expected to access the database
| | -> ExpQ | | | Constructs a lambda which given a connection and parameters will
execute expr. See runStmtRHS.
|
|
|
| runStmtRHS :: ExprParts -> 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.
|
|
| Helper function to construct prepared statements
|
|
| makePrepStmtParts :: String -> String -> Q PrepareParts |
| Creates parts for a prepared statement. Calls makeExprParts.
|
|
| prepStmtLHS :: PrepareParts -> [StmtQ] -> ExpQ |
| Lambda for prepared statements.
|
|
| prepStmtQ :: PrepareParts -> StmtQ |
| A StmtQ which prepares a statement on a database.
|
|
| execPrepStmtRHS :: PrepareParts -> StmtQ |
| A StmtQ to execute a statement on a database.
|
|
| returnExecPrepStmtLHS :: PrepareParts -> [StmtQ] -> StmtQ |
| Creates a StmtQ of type: IO (a1-an -> IO ... ). Where a1-an are
the parameters which must be bound.
|
|
| Produced by Haddock version 2.1.0 |