This module provides datatypes, constructor functions and translation functions to specify SQL criteria including options(group-by, having, order-by)
Author: Mike Tallarek, Julia Krone
Version: 0.2
emptyCriteria
:: Criteria
An empty criteria |
int
:: Int -> Value Int
Constructor for a Value Val of type Int |
float
:: Float -> Value Float
Constructor for a Value Val of type Float |
char
:: Char -> Value Char
Constructor for a Value Val of type Char |
string
:: String -> Value String
Constructor for a Value Val of type String |
bool
:: Bool -> Value Bool
Constructor for a Value Val of type Bool |
date
:: ClockTime -> Value ClockTime
Constructor for a Value Val of type ClockTime |
idVal
:: Int -> Value a
Constructor for Values of ID-types Should just be used internally! |
col
:: Column a -> Value a
Constructor for a Value Col without a rename-number |
colNum
:: Column a -> Int -> Value a
Constructor for a Value Col with a rename-number |
colVal
:: Column a -> Value a -> ColVal
A constructor for ColVal needed for typesafety |
colValAlt
:: String -> String -> SQLValue -> ColVal
Alternative ColVal constructor without typesafety |
isNull
:: Value a -> Constraint
IsNull construnctor |
isNotNull
:: Value a -> Constraint
IsNotNull construnctor |
equal
:: Value a -> Value a -> Constraint
Equal construnctor |
(.=.)
:: Value a -> Value a -> Constraint
Infix Equal |
notEqual
:: Value a -> Value a -> Constraint
NotEqual construnctor |
(./=.)
:: Value a -> Value a -> Constraint
Infix NotEqual |
greaterThan
:: Value a -> Value a -> Constraint
GreatherThan construnctor |
(.>.)
:: Value a -> Value a -> Constraint
Infix GreaterThan |
lessThan
:: Value a -> Value a -> Constraint
LessThan construnctor |
(.<.)
:: Value a -> Value a -> Constraint
Infix LessThan |
greaterThanEqual
:: Value a -> Value a -> Constraint
GreaterThanEqual construnctor |
(.>=.)
:: Value a -> Value a -> Constraint
Infix GreaterThanEqual |
lessThanEqual
:: Value a -> Value a -> Constraint
LessThanEqual construnctor |
(.<=.)
:: Value a -> Value a -> Constraint
Infix LessThanEqual |
like
:: Value a -> Value a -> Constraint
Like construnctor |
(.~.)
:: Value a -> Value a -> Constraint
Infix Like |
between
:: Value a -> Value a -> Value a -> Constraint
Between construnctor |
isIn
:: Value a -> [Value a] -> Constraint
IsIn construnctor |
(.<->.)
:: Value a -> [Value a] -> Constraint
Infix IsIn |
ascOrder
:: Value a -> Option
Constructor for the option: Ascending Order by Column |
descOrder
:: Value a -> Option
Constructor for the option: Descending Order by Column |
groupBy
:: Value a -> GroupByTail -> GroupBy
|
groupByCol
:: Value a -> GroupByTail -> GroupByTail
Constructor to specifiy more than one column for group-by |
having
:: Condition -> GroupByTail
|
noHave
:: GroupByTail
Constructor for empty having-Clause |
condition
:: Constraint -> Condition
|
sumIntCol
:: Specifier -> Value Int -> Value Int -> (Value () -> Value () -> Constraint) -> Condition
having-clauses. |
sumFloatCol
:: Specifier -> Value Float -> Value Float -> (Value () -> Value () -> Constraint) -> Condition
Constructor for aggregation function sum for columns of type float in having-clauses. |
avgIntCol
:: Specifier -> Value Int -> Value Float -> (Value () -> Value () -> Constraint) -> Condition
Constructor for aggregation function avg for columns of type Int in having-clauses. |
avgFloatCol
:: Specifier -> Value Float -> Value Float -> (Value () -> Value () -> Constraint) -> Condition
Constructor for aggregation function avg for columns of type float in having-clauses. |
countCol
:: Specifier -> Value a -> Value Int -> (Value () -> Value () -> Constraint) -> Condition
|
minCol
:: Specifier -> Value a -> Value a -> (Value () -> Value () -> Constraint) -> Condition
Constructor for aggregation function min in having-clauses. |
maxCol
:: Specifier -> Value a -> Value a -> (Value () -> Value () -> Constraint) -> Condition
Constructor for aggregation function max in having-clauses. |
toCColumn
:: Column a -> Column ()
|
toCValue
:: Value a -> Value ()
|
trCriteria
:: Criteria -> String
|
trOption
:: [Option] -> String
|
trCondition
:: Condition -> String
|
trConstraint
:: Constraint -> String
|
trValue
:: Value a -> String
|
trColumn
:: String -> Int -> String
|
trSpecifier
:: Specifier -> String
|
Criterias for queries that can have a constraint and a group-by clause
Constructors:
Criteria
:: Constraint -> (Maybe GroupBy) -> Criteria
specifier for queries
Constructors:
Distinct
:: Specifier
All
:: Specifier
datatype to represent order-by statement
Constructors:
datatype to represent group-by statement
Constructors:
datatype for conditions inside a having-clause
Constructors:
Con
:: Constraint -> Condition
Fun
:: String -> Specifier -> Constraint -> Condition
HAnd
:: [Condition] -> Condition
HOr
:: [Condition] -> Condition
Neg
:: Condition -> Condition
A datatype to compare values. Can be either a SQLValue or a Column with an additional Integer (rename-number). The Integer is for dealing with renamed tables in queries (i.e. Students as 1Students). If the Integer n is 0 the column will be named as usual ("Table"."Column"), otherwise it will be named "nTable"."Column" in the query This is for being able to do complex "where exists" constraints
Constructors:
A datatype thats a combination between a Column and a Value (Needed for update queries)
Constructors:
Type for columns used inside a constraint.
Type synonym: CColumn = Column ()
Type for values used inside a constraint.
Type synonym: CValue = Value ()
Constraints for queries Every constructor with at least one value has a function as a constructor and only that function will be exported to assure type-safety Most of these are just like the Sql-where-commands Exists needs the table-name, an integer and maybe a constraint (where exists (select from table where constraint)) The integer n will rename the table if it has a different value than 0 (where exists (select from table as ntable where...))
Constructors:
IsNull
:: CValue -> Constraint
IsNotNull
:: CValue -> Constraint
BinaryRel
:: RelOp -> CValue -> CValue -> Constraint
Between
:: CValue -> CValue -> CValue -> Constraint
IsIn
:: CValue -> [CValue] -> Constraint
Not
:: Constraint -> Constraint
And
:: [Constraint] -> Constraint
Or
:: [Constraint] -> Constraint
Exists
:: Table -> Int -> Constraint -> Constraint
None
:: Constraint
An empty criteria
|
Constructor for a Value Val of type Int
|
Constructor for a Value Val of type Float
|
Constructor for a Value Val of type Char
|
Constructor for a Value Val of type String
|
Constructor for a Value Val of type Bool
|
Constructor for a Value Val of type ClockTime
|
Constructor for Values of ID-types Should just be used internally!
|
Constructor for a Value Col without a rename-number
|
Constructor for a Value Col with a rename-number
|
A constructor for ColVal needed for typesafety
|
Alternative ColVal constructor without typesafety
|
IsNull construnctor
|
IsNotNull construnctor
|
Equal construnctor
|
Infix Equal
|
NotEqual construnctor
|
Infix NotEqual
|
GreatherThan construnctor
|
Infix GreaterThan
|
LessThan construnctor
|
Infix LessThan
|
GreaterThanEqual construnctor
|
Infix GreaterThanEqual
|
LessThanEqual construnctor
|
Infix LessThanEqual
|
Like construnctor
|
Infix Like
|
Between construnctor
|
IsIn construnctor
|
Infix IsIn |
Constructor for the option: Ascending Order by Column
|
Constructor for the option: Descending Order by Column
|
|
Constructor to specifiy more than one column for group-by
|
|
Constructor for empty having-Clause
|
|
having-clauses. |
Constructor for aggregation function sum for columns of type float in having-clauses. |
Constructor for aggregation function avg for columns of type Int in having-clauses. |
Constructor for aggregation function avg for columns of type float in having-clauses. |
Constructor for aggregation function min in having-clauses.
|
Constructor for aggregation function max in having-clauses.
|
|
|
|
|
|
|
|