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

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

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 = StringSource

type Attribute = StringSource

type Name = StringSource

Data types

data RelOp Source

Instances

Show RelOp 

data SpecialOp Source

Constructors

Order [OrderExpr] 
Top Int 

Instances

Show SpecialOp 

data OrderExpr Source

Constructors

OrderExpr OrderOp PrimExpr 

Instances

Show OrderExpr 

data UnOp Source

Constructors

OpNot 
OpIsNull 
OpIsNotNull 
OpLength 
UnOpOther String 

Instances

Read UnOp 
Show UnOp 

data OrderOp Source

Constructors

OpAsc 
OpDesc 

Instances

Show OrderOp 

data Literal Source

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 -> PrimQuerySource

Creates a projection of some attributes while keeping all other attributes in the relation visible too.

times :: PrimQuery -> PrimQuery -> PrimQuerySource

Takes the cartesian product of two queries.

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.

substAttr :: Assoc -> PrimExpr -> PrimExprSource

Substitute attribute names in an expression.

isConstant :: PrimExpr -> BoolSource

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 -> tSource

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 -> tSource

Fold on PrimExpr