Copyright | Daan Leijen (c) 1999, [email protected] HWT Group (c) 2003, [email protected] |
---|---|
License | BSD-style |
Maintainer | [email protected] |
Stability | experimental |
Portability | non portable |
Safe Haskell | None |
Language | Haskell98 |
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
- data SpecialOp
- data PrimExpr
- data OrderExpr = OrderExpr OrderOp PrimExpr
- data BinOp
- data UnOp
- data OrderOp
- data AggrOp
- data Literal
- 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 -> PrimQuery Source
Creates a projection of some attributes while keeping all other attributes in the relation visible too.
attributes :: PrimQuery -> Scheme Source
Returns the schema (the attributes) of a query
attrInExpr :: PrimExpr -> Scheme Source
Returns all attributes in an expression.
attrInOrder :: [OrderExpr] -> Scheme Source
Returns all attributes in a list of ordering expressions.
isAggregate :: PrimExpr -> Bool Source
isConstant :: PrimExpr -> Bool Source
Determines if a primitive expression represents a constant or is an expression only involving constants.