Portability | non portable |
---|---|
Stability | experimental |
Maintainer | haskelldb-users@lists.sourceforge.net |
Safe Haskell | None |
Database.HaskellDB.PrimQuery
Description
PrimQuery defines the datatype of relational expressions
(PrimQuery
) and some useful functions on PrimQuery's
- type TableName = String
- type Attribute = String
- type Scheme = [Attribute]
- type Assoc = [(Attribute, PrimExpr)]
- type Name = String
- data PrimQuery
- data RelOp
- = Times
- | Union
- | Intersect
- | Divide
- | Difference
- data SpecialOp
- data PrimExpr
- data OrderExpr = OrderExpr OrderOp PrimExpr
- data BinOp
- data UnOp
- data OrderOp
- data AggrOp
- data Literal
- = NullLit
- | DefaultLit
- | BoolLit Bool
- | StringLit String
- | IntegerLit Integer
- | DoubleLit Double
- | DateLit CalendarTime
- | OtherLit String
- extend :: Assoc -> PrimQuery -> PrimQuery
- times :: PrimQuery -> PrimQuery -> PrimQuery
- attributes :: PrimQuery -> Scheme
- attrInExpr :: PrimExpr -> Scheme
- attrInOrder :: [OrderExpr] -> Scheme
- substAttr :: Assoc -> PrimExpr -> PrimExpr
- isAggregate :: PrimExpr -> Bool
- isConstant :: PrimExpr -> Bool
- foldPrimQuery :: (t, TableName -> Scheme -> t, Assoc -> t -> t, PrimExpr -> t -> t, RelOp -> t -> t -> t, Assoc -> t -> t, SpecialOp -> t -> t) -> PrimQuery -> t
- foldPrimExpr :: (Attribute -> t, Literal -> t, BinOp -> t -> t -> t, UnOp -> t -> t, AggrOp -> t -> t, [(t, t)] -> t -> t, [t] -> t, Maybe Name -> t -> t, Name -> [t] -> t, Name -> t -> t) -> PrimExpr -> t
Type Declarations
Types
Data types
Constructors
AttrExpr Attribute | |
BinExpr BinOp PrimExpr PrimExpr | |
UnExpr UnOp PrimExpr | |
AggrExpr AggrOp PrimExpr | |
ConstExpr Literal | |
CaseExpr [(PrimExpr, PrimExpr)] PrimExpr | |
ListExpr [PrimExpr] | |
ParamExpr (Maybe Name) PrimExpr | |
FunExpr Name [PrimExpr] | |
CastExpr Name PrimExpr | Cast an expression to a given type. |
Constructors
NullLit | |
DefaultLit | represents a default value |
BoolLit Bool | |
StringLit String | |
IntegerLit Integer | |
DoubleLit Double | |
DateLit CalendarTime | |
OtherLit String | used for hacking in custom SQL |
Function declarations
extend :: Assoc -> PrimQuery -> PrimQuerySource
Creates a projection of some attributes while keeping all other attributes in the relation visible too.
attributes :: PrimQuery -> SchemeSource
Returns the schema (the attributes) of a query
attrInExpr :: PrimExpr -> SchemeSource
Returns all attributes in an expression.
attrInOrder :: [OrderExpr] -> SchemeSource
Returns all attributes in a list of ordering expressions.
isAggregate :: PrimExpr -> BoolSource
isConstant :: PrimExpr -> BoolSource
Determines if a primitive expression represents a constant or is an expression only involving constants.