Module Database.CDBI.QueryTypes

This module contains datatype declarations, constructor functions selectors and translation functions for complex select queries in particular for those selecting (1 to 5) single columns.

Author: Julia Krone

Summary of exported operations:

innerJoin :: Constraint -> Join  Deterministic 
Constructorfunction for an inner join
crossJoin :: Join  Deterministic 
Constructorfunction for cross join
sum :: Specifier -> ColumnDescription a -> (String,ColumnDescription Float)  Deterministic 
Constructor for aggregation function sum in select-clauses.
avg :: Specifier -> ColumnDescription a -> (String,ColumnDescription Float)  Deterministic 
Constructor for aggregation function avg in select-clauses.
count :: Specifier -> ColumnDescription a -> (String,ColumnDescription Int)  Deterministic 
Constructor for aggregation function count in select-clauses.
minV :: ColumnDescription a -> (String,ColumnDescription a)  Deterministic 
Constructor for aggregation function min in select-clauses.
maxV :: ColumnDescription a -> (String,ColumnDescription a)  Deterministic 
Constructor for aggregation function max in select-clauses.
none :: ColumnDescription a -> (String,ColumnDescription a)  Deterministic 
Constructor function in case no aggregation function is specified.
caseResultInt :: (SQLType,SQLValue -> Int)  Deterministic 
caseResultFloat :: (SQLType,SQLValue -> Float)  Deterministic 
caseResultString :: (SQLType,SQLValue -> String)  Deterministic 
caseResultBool :: (SQLType,SQLValue -> Bool)  Deterministic 
caseResultChar :: (SQLType,SQLValue -> Char)  Deterministic 
caseThen :: Condition -> Value a -> Value a -> (SQLType,SQLValue -> a) -> ColumnSingleCollection a  Deterministic 
Constructor function for representation of statement: CASE WHEN condition THEN val1 ELSE val2 END.
singleCol :: ColumnDescription a -> Int -> (ColumnDescription a -> (String,ColumnDescription b)) -> ColumnSingleCollection b  Deterministic 
Constructorfunction for ColumnSingleCollection.
tupleCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> (ColumnSingleCollection a,ColumnSingleCollection b)  Deterministic 
tripleCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> ColumnSingleCollection c -> (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c)  Deterministic 
fourCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> ColumnSingleCollection c -> ColumnSingleCollection d -> (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c,ColumnSingleCollection d)  Deterministic 
fiveCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> ColumnSingleCollection c -> ColumnSingleCollection d -> ColumnSingleCollection e -> (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c,ColumnSingleCollection d,ColumnSingleCollection e)  Deterministic 
sixCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> ColumnSingleCollection c -> ColumnSingleCollection d -> ColumnSingleCollection e -> ColumnSingleCollection f -> (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c,ColumnSingleCollection d,ColumnSingleCollection e,ColumnSingleCollection f)  Deterministic 
Constructor function for ColumnSixTupleCollection.
getSingleType :: SingleColumnSelect a -> [SQLType]  Deterministic 
getSingleValFunc :: SingleColumnSelect a -> SQLValue -> a  Deterministic 
getTupleTypes :: TupleColumnSelect a b -> [SQLType]  Deterministic 
getTupleValFuncs :: TupleColumnSelect a b -> (SQLValue -> a,SQLValue -> b)  Deterministic 
getTripleTypes :: TripleColumnSelect a b c -> [SQLType]  Deterministic 
getTripleValFuncs :: TripleColumnSelect a b c -> (SQLValue -> a,SQLValue -> b,SQLValue -> c)  Deterministic 
getFourTupleTypes :: FourColumnSelect a b c d -> [SQLType]  Deterministic 
getFourTupleValFuncs :: FourColumnSelect a b c d -> (SQLValue -> a,SQLValue -> b,SQLValue -> c,SQLValue -> d)  Deterministic 
getFiveTupleTypes :: FiveColumnSelect a b c d e -> [SQLType]  Deterministic 
getFiveTupleValFuncs :: FiveColumnSelect a b c d e -> (SQLValue -> a,SQLValue -> b,SQLValue -> c,SQLValue -> d,SQLValue -> e)  Deterministic 
getSixTupleTypes :: SixColumnSelect a b c d e f -> [SQLType]  Deterministic 
getSixTupleValFuncs :: SixColumnSelect a b c d e f -> (SQLValue -> a,SQLValue -> b,SQLValue -> c,SQLValue -> d,SQLValue -> e,SQLValue -> f)  Deterministic 
trSingleSelectQuery :: SingleColumnSelect a -> String  Non-deterministic 
trTupleSelectQuery :: TupleColumnSelect a b -> String  Non-deterministic 
trTripleSelectQuery :: TripleColumnSelect a b c -> String  Non-deterministic 
trFourTupleSelectQuery :: FourColumnSelect a b c d -> String  Non-deterministic 
trFiveTupleSelectQuery :: FiveColumnSelect a b c d e -> String  Non-deterministic 
trSixTupleSelectQuery :: SixColumnSelect a b c d e f -> String  Non-deterministic 
trSetOp :: SetOp -> String  Deterministic 
trLimit :: Maybe Int -> String  Deterministic 
asTable :: String -> Int -> String  Deterministic 
trJoinPart1 :: Join -> String  Deterministic 
trJoinPart2 :: Join -> String  Non-deterministic 

Exported datatypes:


SetOp

Constructors:

  • Union :: SetOp
  • Intersect :: SetOp
  • Except :: SetOp

Join

datatype for joins

Constructors:


TableClause

data structure to represent a table-clause (tables and joins) in a way that at least one table has to be specified

Constructors:


ColumnSingleCollection

Datatype representing a single column in a select-clause. Can be just a column connected with an alias and an optional aggregation function(String) or a Case-when-then-statement

Constructors:


ColumnTupleCollection

Datatype to select two different columns which can be of different types and from different tables.

Type synonym: ColumnTupleCollection a b = (ColumnSingleCollection a,ColumnSingleCollection b)


ColumnTripleCollection

Datatype to select three different columns which can be of different types and from different tables.

Type synonym: ColumnTripleCollection a b c = (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c)


ColumnFourTupleCollection

Datatype to select four different columns which can be of different types and from different tables.

Type synonym: ColumnFourTupleCollection a b c d = (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c,ColumnSingleCollection d)


ColumnFiveTupleCollection

Datatype to select five different columns which can be of different types and from different tables.

Type synonym: ColumnFiveTupleCollection a b c d e = (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c,ColumnSingleCollection d,ColumnSingleCollection e)


ColumnSixTupleCollection

Datatype to select five different columns which can be of different types and from different tables.

Type synonym: ColumnSixTupleCollection a b c d e f = (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c,ColumnSingleCollection d,ColumnSingleCollection e,ColumnSingleCollection f)


SingleColumnSelect

Datatype to describe all parts of a select-query without Setoperators order-by and limit (selecthead) for a single column.

Constructors:


TupleColumnSelect

Datatype to describe all parts of a select-query without Setoperators order-by and limit (selecthead) for two columns.

Constructors:


TripleColumnSelect

Datatype to describe all parts of a select-query without Setoperators order-by and limit (selecthead) for three columns.

Constructors:


FourColumnSelect

Datatype to describe all parts of a select-query without Setoperators order-by and limit (selecthead) for four columns.

Constructors:


FiveColumnSelect

Datatype to describe all parts of a select-query without Setoperators order-by and limit (selecthead) for five columns.

Constructors:


SixColumnSelect

Datatype to describe all parts of a select-query without Setoperators order-by and limit (selecthead) for five columns.

Constructors:


Exported operations:

innerJoin :: Constraint -> Join  Deterministic 

Constructorfunction for an inner join

Further infos:
  • solution complete, i.e., able to compute all solutions

crossJoin :: Join  Deterministic 

Constructorfunction for cross join

Further infos:
  • solution complete, i.e., able to compute all solutions

sum :: Specifier -> ColumnDescription a -> (String,ColumnDescription Float)  Deterministic 

Constructor for aggregation function sum in select-clauses. A pseudo-ResultColumnDescription of type float is created for correct return type.

Further infos:
  • solution complete, i.e., able to compute all solutions

avg :: Specifier -> ColumnDescription a -> (String,ColumnDescription Float)  Deterministic 

Constructor for aggregation function avg in select-clauses. A pseudo-ResultColumnDescription of type float is created for correct return type.

Further infos:
  • solution complete, i.e., able to compute all solutions

count :: Specifier -> ColumnDescription a -> (String,ColumnDescription Int)  Deterministic 

Constructor for aggregation function count in select-clauses. A pseudo-ResultColumnDescription of type float is created for correct return type.

Further infos:
  • solution complete, i.e., able to compute all solutions

minV :: ColumnDescription a -> (String,ColumnDescription a)  Deterministic 

Constructor for aggregation function min in select-clauses.

Further infos:
  • solution complete, i.e., able to compute all solutions

maxV :: ColumnDescription a -> (String,ColumnDescription a)  Deterministic 

Constructor for aggregation function max in select-clauses.

Further infos:
  • solution complete, i.e., able to compute all solutions

none :: ColumnDescription a -> (String,ColumnDescription a)  Deterministic 

Constructor function in case no aggregation function is specified.

Further infos:
  • solution complete, i.e., able to compute all solutions

caseResultInt :: (SQLType,SQLValue -> Int)  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

caseResultFloat :: (SQLType,SQLValue -> Float)  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

caseResultString :: (SQLType,SQLValue -> String)  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

caseResultBool :: (SQLType,SQLValue -> Bool)  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

caseResultChar :: (SQLType,SQLValue -> Char)  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

caseThen :: Condition -> Value a -> Value a -> (SQLType,SQLValue -> a) -> ColumnSingleCollection a  Deterministic 

Constructor function for representation of statement: CASE WHEN condition THEN val1 ELSE val2 END. It does only work for the same type in then and else branch.

Further infos:
  • solution complete, i.e., able to compute all solutions

singleCol :: ColumnDescription a -> Int -> (ColumnDescription a -> (String,ColumnDescription b)) -> ColumnSingleCollection b  Deterministic 

Constructorfunction for ColumnSingleCollection.

tupleCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> (ColumnSingleCollection a,ColumnSingleCollection b)  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

tripleCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> ColumnSingleCollection c -> (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c)  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

sixCol :: ColumnSingleCollection a -> ColumnSingleCollection b -> ColumnSingleCollection c -> ColumnSingleCollection d -> ColumnSingleCollection e -> ColumnSingleCollection f -> (ColumnSingleCollection a,ColumnSingleCollection b,ColumnSingleCollection c,ColumnSingleCollection d,ColumnSingleCollection e,ColumnSingleCollection f)  Deterministic 

Constructor function for ColumnSixTupleCollection.

Further infos:
  • solution complete, i.e., able to compute all solutions

getTupleValFuncs :: TupleColumnSelect a b -> (SQLValue -> a,SQLValue -> b)  Deterministic 

getTripleValFuncs :: TripleColumnSelect a b c -> (SQLValue -> a,SQLValue -> b,SQLValue -> c)  Deterministic 

getFourTupleValFuncs :: FourColumnSelect a b c d -> (SQLValue -> a,SQLValue -> b,SQLValue -> c,SQLValue -> d)  Deterministic 

getFiveTupleTypes :: FiveColumnSelect a b c d e -> [SQLType]  Deterministic 

getFiveTupleValFuncs :: FiveColumnSelect a b c d e -> (SQLValue -> a,SQLValue -> b,SQLValue -> c,SQLValue -> d,SQLValue -> e)  Deterministic 

getSixTupleTypes :: SixColumnSelect a b c d e f -> [SQLType]  Deterministic 

getSixTupleValFuncs :: SixColumnSelect a b c d e f -> (SQLValue -> a,SQLValue -> b,SQLValue -> c,SQLValue -> d,SQLValue -> e,SQLValue -> f)  Deterministic 

trTupleSelectQuery :: TupleColumnSelect a b -> String  Non-deterministic 

trTripleSelectQuery :: TripleColumnSelect a b c -> String  Non-deterministic 

trFourTupleSelectQuery :: FourColumnSelect a b c d -> String  Non-deterministic 

trFiveTupleSelectQuery :: FiveColumnSelect a b c d e -> String  Non-deterministic 

trSixTupleSelectQuery :: SixColumnSelect a b c d e f -> String  Non-deterministic 

trSetOp :: SetOp -> String  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

trLimit :: Maybe Int -> String  Deterministic 

asTable :: String -> Int -> String  Deterministic 

trJoinPart1 :: Join -> String  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

trJoinPart2 :: Join -> String  Non-deterministic