|
| Database.HaskellDB.Query | | Portability | non portable | | Stability | experimental | | Maintainer | haskelldb-users@lists.sourceforge.net |
|
|
|
|
|
| Description |
| Basic combinators for building type-safe queries.
The Query monad constructs a relational expression
(PrimQuery).
|
|
| Synopsis |
|
|
|
|
| Data and class declarations
|
|
|
| Type of relations, contains the attributes
of the relation and an Alias to which the
attributes are renamed in the PrimQuery.
| | Constructors | | Instances | |
|
|
|
| Typed attributes
| | Constructors | | Instances | |
|
|
|
| Basic tables, contains table name and an
association from attributes to attribute
names in the real table.
| | Constructors | |
|
|
|
Instances | |
|
|
|
| Type of normal expressions, contains the untyped PrimExpr.
| | Constructors | | Instances | |
|
|
|
Instances | |
|
|
|
| Instances | |
|
|
|
| Instances | |
|
|
|
| Class of expression types.
| | Instances | |
|
|
|
| Class of expressions that can be used with project.
| | Instances | |
|
|
| class ProjectRec r er | r -> er | Source |
|
| Class of records that can be used with project.
All all the values must be instances of ProjectExpr for the
record to be an instance of ProjectRec.
| | Instances | |
|
|
| class InsertRec r er | r -> er | Source |
|
| Class of records that can be used with insert.
All all the values must be instances of InsertExpr for the
record to be an instance of InsertRec.
| | Instances | |
|
|
| class ConstantRecord r cr | r -> cr where | Source |
|
| | Methods | | constantRecord :: r -> cr | Source |
|
| | Instances | |
|
|
| Operators
|
|
|
| (.==.) is used in a similar way as the standard op (==) in
Haskell and = in SQL, but takes two Expr as arguments and
returns an Expr Bool.
|
|
|
| (.<>.) is used in a similar way as the standard op (/=) in
Haskell and <> in SQL, but takes two Expr as arguments and
returns an Expr Bool.
|
|
|
| As with (.==.) and (.<>.), this op has a standard Haskell
op counterpart; (<) and an SQL counterpart; <
|
|
|
| As with (.==.) and (.<>.), this op have a standard Haskell
op counterpart, (<=) and an SQL counterpart; <=.
|
|
|
| As with (.==.) and (.<>.), this op have a standard Haskell
op counterpart, (>) and an SQL counterpart; >.
|
|
|
| As with (.==.) and (.<>.), this op have a standard Haskell
op counterpart, (>=) and an SQL counterpart; >=.
|
|
|
| "Logical and" on Expr, similar to the (&&) op in
Haskell and AND in SQL.
|
|
|
| "Logical or" on Expr, similar to the (||) op in
Haskell and OR in SQL.
|
|
|
| Multiplication
|
|
|
| Division
|
|
|
| Modulo
|
|
|
| Addition
|
|
|
| Subtraction
|
|
|
| Concatenates two String-expressions.
|
|
|
| :: | | | => Attr f a | Expression
| | -> e a | New record
| | -> Record (RecCons f (e a) RecNil) | | | Creates a record field.
Similar to '(.=.)', but gets the field label from an Attr.
|
|
|
|
| :: ShowConstant a | | | => Attr f a | Field value
| | -> a | New record
| | -> Record (RecCons f (Expr a) RecNil) | | | Convenience operator for constructing records of constants.
Useful primarily with insert.
f <<- x is the same as f << constant x
|
|
|
| Function declarations
|
|
|
| Specifies a subset of the columns in the table.
|
|
|
| Restricts the records to only those who evaluates the
expression to True.
|
|
|
| Return all records from a specific table.
|
|
|
| Restricts the relation given to only return unique records. Upshot
is all projected attributes will be grouped
|
|
|
| Return all records which are present in at least
one of the relations.
|
|
|
| Return all records which are present in both relations.
|
|
|
| Not in SQL92.
|
|
|
| Return all records from the first relation that are not
present in the second relation.
|
|
|
| The inverse of an Expr Bool.
|
|
|
The HaskellDB counterpart to the SQL LIKE keyword.
In the expresions, % is a wildcard representing any characters
in the same position relavtive to the given characters and
_ is a wildcard representing one character e.g.
like (constant "ABCDEFFF") (constant "AB%F_F")
is true while
like (constant "ABCDEF") (constant "AC%F")
is false.
Note that SQL92 does not specify whether LIKE is case-sensitive or not.
Different database systems implement this differently.
|
|
|
| Returns true if the value of the first operand is
equal to the value of any of the expressions in the
list operand.
|
|
|
| Produces the concatenation of two String-expressions.
|
|
|
| Gets the length of a string.
|
|
|
| Returns true if the expression is Null.
|
|
|
| The inverse of isNull, returns false
if the expression supplied is Null.
|
|
|
| :: | | | => Expr a | A nullable expression
| | -> Expr (Maybe a) | | | -> Expr a | | | Takes a default value a and a nullable value. If the value is NULL,
the default value is returned, otherwise the value itself is returned.
Simliar to fromMaybe
|
|
|
|
| Creates a constant expression from a haskell value.
|
|
|
| Turn constant data into a nullable expression.
Same as constant . Just
|
|
|
| Returns the number of records (=rows) in a query.
|
|
|
| Returns the total sum of a column.
|
|
|
| Returns the highest value of a column.
|
|
|
| Returns the lowest value of a column.
|
|
|
| Returns the average of a column.
|
|
|
| Returns the standard deviation of a column.
|
|
|
|
|
| Returns the standard variance of a column.
|
|
|
|
|
| Use this together with the function order to
order the results of a query in ascending order.
Takes a relation and an attribute of that relation, which
is used for the ordering.
|
|
|
| Use this together with the function order to
order the results of a query in descending order.
Takes a relation and an attribute of that relation, which
is used for the ordering.
|
|
|
| Order the results of a query.
Use this with the asc or desc functions.
|
|
|
| Return the n topmost records.
|
|
|
| :: | | | => [(Expr Bool, Expr a)] | Else-expression.
| | -> Expr a | | | -> Expr a | | | Creates a conditional expression.
Returns the value of the expression corresponding to the first
true condition. If none of the conditions are true, the value of
the else-expression is returned.
|
|
|
| _default :: ExprDefault a | Source |
|
| The default value of the column. Only works with insert.
|
|
| Internals
|
|
|
|
|
|
|
|
|
| Get the name of a table.
|
|
|
|
|
|
|
|
|
|
| Produced by Haddock version 2.6.0 |