haskelldb-2.2.2: 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 Scheme = [Attribute]

type Name = String

Data types

data RelOp

Instances

data SpecialOp

Constructors

Order [OrderExpr] 
Top Int 

Instances

data OrderExpr

Constructors

OrderExpr OrderOp PrimExpr 

Instances

data OrderOp

Constructors

OpAsc 
OpDesc 

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 :: [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