|
Database.HaskellDB.PrimQuery | Portability | non portable | Stability | experimental | Maintainer | dp03-7@mdstud.chalmers.se |
|
|
|
|
|
Description |
PrimQuery defines the datatype of relational expressions
(PrimQuery) and some useful functions on PrimQuery's
$Revision: 1.26 $
|
|
Synopsis |
|
type TableName = String | | type Attribute = String | | type Scheme = [Attribute] | | type Assoc = [(Attribute, PrimExpr)] | | | | | | | | | | | | | | | | | | extend :: Assoc -> PrimQuery -> PrimQuery | | times :: PrimQuery -> PrimQuery -> PrimQuery | | attributes :: PrimQuery -> Scheme | | attrInExpr :: PrimExpr -> Scheme | | attrInOrder :: [PrimExpr] -> Scheme | | substAttr :: Assoc -> PrimExpr -> PrimExpr | | isAggregate :: PrimExpr -> Bool | | nestedAggregate :: PrimExpr -> Bool | | foldPrimQuery :: (t, TableName -> Scheme -> t, Assoc -> t -> t, PrimExpr -> t -> t, RelOp -> t -> 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) -> PrimExpr -> t | | ppPrimQuery :: PrimQuery -> Doc | | ppPrimExpr :: PrimExpr -> Doc | | ppRelOp :: RelOp -> Doc | | ppBinOp :: BinOp -> Doc | | ppAggrOp :: AggrOp -> Doc | | ppSpecialOp :: SpecialOp -> Doc |
|
|
|
Type Declarations
|
|
Types
|
|
type TableName = String |
|
type Attribute = String |
|
type Scheme = [Attribute] |
|
type Assoc = [(Attribute, PrimExpr)] |
|
Data types
|
|
data PrimQuery |
Constructors | | Instances | |
|
|
data RelOp |
Constructors | Times | | Union | | Intersect | | Divide | | Difference | |
| Instances | |
|
|
data SpecialOp |
Constructors | Order [PrimExpr] | always UnExpr (OpDesc|OpAsc) (AttrExpr name)
| Top Bool Integer | True = top percent, False = top n
|
| Instances | |
|
|
data PrimExpr |
Constructors | | Instances | |
|
|
data BinOp |
Constructors | OpEq | | OpLt | | OpLtEq | | OpGt | | OpGtEq | | OpNotEq | | OpAnd | | OpOr | | OpLike | | OpIn | | OpOther String | | OpCat | | OpPlus | | OpMinus | | OpMul | | OpDiv | | OpMod | | OpBitNot | | OpBitAnd | | OpBitOr | | OpBitXor | | OpAsg | |
| Instances | |
|
|
data UnOp |
Constructors | OpNot | | OpAsc | | OpDesc | | OpIsNull | | OpIsNotNull | | OpLength | | UnOpOther String | |
| Instances | |
|
|
data AggrOp |
Constructors | AggrCount | | AggrSum | | AggrAvg | | AggrMin | | AggrMax | | AggrStdDev | | AggrStdDevP | | AggrVar | | AggrVarP | | AggrOther String | |
| Instances | |
|
|
data Literal |
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
|
| Instances | |
|
|
Function declarations
|
|
extend :: Assoc -> PrimQuery -> PrimQuery |
Creates a projection of some attributes while
keeping all other attributes in the relation visible too.
|
|
times :: PrimQuery -> PrimQuery -> PrimQuery |
Takes the cartesian product of two queries.
|
|
attributes :: PrimQuery -> Scheme |
Returns the schema (the attributes) of a query
|
|
attrInExpr :: PrimExpr -> Scheme |
Returns all attributes in an expression.
|
|
attrInOrder :: [PrimExpr] -> Scheme |
Returns all attributes in a list of expressions.
|
|
substAttr :: Assoc -> PrimExpr -> PrimExpr |
Substitute attribute names in an expression.
|
|
isAggregate :: PrimExpr -> Bool |
|
nestedAggregate :: PrimExpr -> Bool |
|
foldPrimQuery :: (t, TableName -> Scheme -> t, Assoc -> t -> t, PrimExpr -> t -> t, RelOp -> t -> t -> t, SpecialOp -> t -> t) -> PrimQuery -> t |
Fold on PrimQuery
|
|
foldPrimExpr :: (Attribute -> t, Literal -> t, BinOp -> t -> t -> t, UnOp -> t -> t, AggrOp -> t -> t, [(t, t)] -> t -> t) -> PrimExpr -> t |
Fold on PrimExpr
|
|
Pretty printers
|
|
ppPrimQuery :: PrimQuery -> Doc |
Pretty prints a PrimQuery
|
|
ppPrimExpr :: PrimExpr -> Doc |
Pretty prints a PrimExpr
|
|
ppRelOp :: RelOp -> Doc |
Pretty prints a RelOp
|
|
ppBinOp :: BinOp -> Doc |
Pretty prints a BinOp
|
|
ppAggrOp :: AggrOp -> Doc |
Pretty prints an AggrOp
|
|
ppSpecialOp :: SpecialOp -> Doc |
Pretty prints a 'Special Op'
|
|
Produced by Haddock version 0.8 |