haskelldb-0.9: ContentsIndex
Database.HaskellDB.PrimQuery
Portabilitynon portable
Stabilityexperimental
Maintainerdp03-7@mdstud.chalmers.se
Contents
Type Declarations
Types
Data types
Function declarations
Pretty printers
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)]
data PrimQuery
= BaseTable TableName Scheme
| Project Assoc PrimQuery
| Restrict PrimExpr PrimQuery
| Binary RelOp PrimQuery PrimQuery
| Special SpecialOp PrimQuery
| Empty
data RelOp
= Times
| Union
| Intersect
| Divide
| Difference
data SpecialOp
= Order [PrimExpr]
| Top Bool Integer
data PrimExpr
= AttrExpr Attribute
| BinExpr BinOp PrimExpr PrimExpr
| UnExpr UnOp PrimExpr
| AggrExpr AggrOp PrimExpr
| ConstExpr Literal
| CaseExpr [(PrimExpr, PrimExpr)] PrimExpr
data BinOp
= OpEq
| OpLt
| OpLtEq
| OpGt
| OpGtEq
| OpNotEq
| OpAnd
| OpOr
| OpLike
| OpIn
| OpOther String
| OpCat
| OpPlus
| OpMinus
| OpMul
| OpDiv
| OpMod
| OpBitNot
| OpBitAnd
| OpBitOr
| OpBitXor
| OpAsg
data UnOp
= OpNot
| OpAsc
| OpDesc
| OpIsNull
| OpIsNotNull
| OpLength
| UnOpOther String
data AggrOp
= AggrCount
| AggrSum
| AggrAvg
| AggrMin
| AggrMax
| AggrStdDev
| AggrStdDevP
| AggrVar
| AggrVarP
| AggrOther String
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 :: [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
BaseTable TableName Scheme
Project Assoc PrimQuery
Restrict PrimExpr PrimQuery
Binary RelOp PrimQuery PrimQuery
Special SpecialOp PrimQuery
Empty
show/hide Instances
data RelOp
Constructors
Times
Union
Intersect
Divide
Difference
show/hide Instances
Show RelOp
data SpecialOp
Constructors
Order [PrimExpr]always UnExpr (OpDesc|OpAsc) (AttrExpr name)
Top Bool IntegerTrue = top percent, False = top n
show/hide Instances
data PrimExpr
Constructors
AttrExpr Attribute
BinExpr BinOp PrimExpr PrimExpr
UnExpr UnOp PrimExpr
AggrExpr AggrOp PrimExpr
ConstExpr Literal
CaseExpr [(PrimExpr, PrimExpr)] PrimExpr
show/hide 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
show/hide Instances
Read BinOp
Show BinOp
data UnOp
Constructors
OpNot
OpAsc
OpDesc
OpIsNull
OpIsNotNull
OpLength
UnOpOther String
show/hide Instances
Read UnOp
Show UnOp
data AggrOp
Constructors
AggrCount
AggrSum
AggrAvg
AggrMin
AggrMax
AggrStdDev
AggrStdDevP
AggrVar
AggrVarP
AggrOther String
show/hide Instances
Read AggrOp
Show AggrOp
data Literal
Constructors
NullLit
DefaultLitrepresents a default value
BoolLit Bool
StringLit String
IntegerLit Integer
DoubleLit Double
DateLit CalendarTime
OtherLit Stringused for hacking in custom SQL
show/hide Instances
Read Literal
Show Literal
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