haskelldb-2.1.0: A library of combinators for generating and executing SQL statements.

Portabilitynon portable
Stabilityexperimental
Maintainerhaskelldb-users@lists.sourceforge.net

Database.HaskellDB.PrimQuery

Contents

Description

PrimQuery defines the datatype of relational expressions (PrimQuery) and some useful functions on PrimQuery's

Synopsis

Type Declarations

Types

type TableName = String

type Attribute = String

type Scheme = [Attribute]

type Name = String

Data types

data RelOp

Instances

Show RelOp 

data SpecialOp

Constructors

Order [OrderExpr] 
Top Int 

Instances

Show SpecialOp 

data OrderExpr

Constructors

OrderExpr OrderOp PrimExpr 

Instances

Show OrderExpr 

data UnOp

Constructors

OpNot 
OpIsNull 
OpIsNotNull 
OpLength 
UnOpOther String 

Instances

Read UnOp 
Show UnOp 

data OrderOp

Constructors

OpAsc 
OpDesc 

Instances

Show OrderOp 

data AggrOp

Instances

Read AggrOp 
Show AggrOp 

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

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 :: [OrderExpr] -> Scheme

Returns all attributes in a list of ordering expressions.

substAttr :: Assoc -> PrimExpr -> PrimExpr

Substitute attribute names in an expression.

isConstant :: PrimExpr -> Bool

Determines if a primitive expression represents a constant or is an expression only involving constants.

foldPrimQuery :: (t, TableName -> Scheme -> t, Assoc -> t -> t, PrimExpr -> t -> t, RelOp -> t -> t -> t, Assoc -> 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, [t] -> t, Maybe Name -> t -> t, Name -> [t] -> t, Name -> t -> t) -> PrimExpr -> t

Fold on PrimExpr