beam-core-0.7.2.1: Type-safe, feature-complete SQL query and manipulation interface for Haskell

Safe HaskellNone
LanguageHaskell2010

Database.Beam.Backend.SQL.SQL92

Contents

Description

Finally tagless encoding of SQL92 syntax

Synopsis

Documentation

Finally tagless style

class HasSqlValueSyntax expr ty where Source #

Minimal complete definition

sqlValueSyntax

Methods

sqlValueSyntax :: ty -> expr Source #

Instances

HasSqlValueSyntax Value Bool Source # 
HasSqlValueSyntax Value Double Source # 
HasSqlValueSyntax Value Int Source # 
HasSqlValueSyntax Value Int16 Source # 
HasSqlValueSyntax Value Int32 Source # 
HasSqlValueSyntax Value Int64 Source # 
HasSqlValueSyntax Value Integer Source # 
HasSqlValueSyntax Value Word Source # 
HasSqlValueSyntax Value Word16 Source # 
HasSqlValueSyntax Value Word32 Source # 
HasSqlValueSyntax Value Word64 Source # 
HasSqlValueSyntax Value ByteString Source # 
HasSqlValueSyntax Value String Source # 
HasSqlValueSyntax Value Text Source # 
HasSqlValueSyntax Value UTCTime Source # 
HasSqlValueSyntax Value LocalTime Source # 
HasSqlValueSyntax Value TimeOfDay Source # 
HasSqlValueSyntax Value Day Source # 
HasSqlValueSyntax Value SqlNull Source # 
HasSqlValueSyntax SqlSyntaxBuilder Bool Source # 
HasSqlValueSyntax SqlSyntaxBuilder Int Source # 
HasSqlValueSyntax SqlSyntaxBuilder Int32 Source # 
HasSqlValueSyntax SqlSyntaxBuilder Text Source # 
HasSqlValueSyntax SqlSyntaxBuilder SqlNull Source # 
HasSqlValueSyntax syntax x => HasSqlValueSyntax syntax (SqlSerial x) Source # 

Methods

sqlValueSyntax :: SqlSerial x -> syntax Source #

HasSqlValueSyntax Value x => HasSqlValueSyntax Value (Maybe x) Source # 
HasSqlValueSyntax vs t => HasSqlValueSyntax vs (Tagged k tag t) Source # 

Methods

sqlValueSyntax :: Tagged k tag t -> vs Source #

class (IsSql92SelectSyntax (Sql92SelectSyntax cmd), IsSql92InsertSyntax (Sql92InsertSyntax cmd), IsSql92UpdateSyntax (Sql92UpdateSyntax cmd), IsSql92DeleteSyntax (Sql92DeleteSyntax cmd)) => IsSql92Syntax cmd where Source #

Minimal complete definition

selectCmd, insertCmd, updateCmd, deleteCmd

Associated Types

type Sql92SelectSyntax cmd :: * Source #

type Sql92InsertSyntax cmd :: * Source #

type Sql92UpdateSyntax cmd :: * Source #

type Sql92DeleteSyntax cmd :: * Source #

class (IsSql92ExpressionSyntax (Sql92SelectTableExpressionSyntax select), IsSql92AggregationExpressionSyntax (Sql92SelectTableExpressionSyntax select), IsSql92ProjectionSyntax (Sql92SelectTableProjectionSyntax select), IsSql92FromSyntax (Sql92SelectTableFromSyntax select), IsSql92GroupingSyntax (Sql92SelectTableGroupingSyntax select), IsSql92AggregationSetQuantifierSyntax (Sql92SelectTableSetQuantifierSyntax select), Sql92GroupingExpressionSyntax (Sql92SelectTableGroupingSyntax select) ~ Sql92SelectTableExpressionSyntax select, Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax select) ~ Sql92SelectTableExpressionSyntax select, Sql92SelectSelectTableSyntax (Sql92SelectTableSelectSyntax select) ~ select, Eq (Sql92SelectTableExpressionSyntax select)) => IsSql92SelectTableSyntax select where Source #

Methods

selectTableStmt Source #

unionTables :: Bool -> select -> select -> select Source #

intersectTables :: Bool -> select -> select -> select Source #

exceptTable :: Bool -> select -> select -> select Source #

Instances

IsSql92SelectTableSyntax SelectTable Source # 
IsSql92SelectTableSyntax SqlSyntaxBuilder Source # 

class IsSql92DataTypeSyntax dataType where Source #

Methods

domainType :: Text -> dataType Source #

charType :: Maybe Word -> Maybe Text -> dataType Source #

varCharType :: Maybe Word -> Maybe Text -> dataType Source #

nationalCharType :: Maybe Word -> dataType Source #

nationalVarCharType :: Maybe Word -> dataType Source #

bitType :: Maybe Word -> dataType Source #

varBitType :: Maybe Word -> dataType Source #

numericType :: Maybe (Word, Maybe Word) -> dataType Source #

decimalType :: Maybe (Word, Maybe Word) -> dataType Source #

intType :: dataType Source #

smallIntType :: dataType Source #

floatType :: Maybe Word -> dataType Source #

doubleType :: dataType Source #

realType :: dataType Source #

dateType :: dataType Source #

timeType Source #

Arguments

:: Maybe Word 
-> Bool

With time zone

-> dataType 

timestampType Source #

Arguments

:: Maybe Word 
-> Bool

With time zone

-> dataType 

Instances

IsSql92DataTypeSyntax DataType Source # 
IsSql92DataTypeSyntax SqlSyntaxBuilder Source # 

class (HasSqlValueSyntax (Sql92ExpressionValueSyntax expr) Int, HasSqlValueSyntax (Sql92ExpressionValueSyntax expr) Bool, IsSql92FieldNameSyntax (Sql92ExpressionFieldNameSyntax expr), IsSql92QuantifierSyntax (Sql92ExpressionQuantifierSyntax expr), Typeable expr) => IsSql92ExpressionSyntax expr where Source #

Methods

valueE :: Sql92ExpressionValueSyntax expr -> expr Source #

rowE :: [expr] -> expr Source #

quantifierListE :: [expr] -> expr Source #

coalesceE :: [expr] -> expr Source #

caseE :: [(expr, expr)] -> expr -> expr Source #

fieldE :: Sql92ExpressionFieldNameSyntax expr -> expr Source #

betweenE :: expr -> expr -> expr -> expr Source #

andE :: expr -> expr -> expr Source #

orE :: expr -> expr -> expr Source #

addE :: expr -> expr -> expr Source #

subE :: expr -> expr -> expr Source #

mulE :: expr -> expr -> expr Source #

divE :: expr -> expr -> expr Source #

likeE :: expr -> expr -> expr Source #

modE :: expr -> expr -> expr Source #

overlapsE :: expr -> expr -> expr Source #

nullIfE :: expr -> expr -> expr Source #

positionE :: expr -> expr -> expr Source #

eqE :: Maybe (Sql92ExpressionQuantifierSyntax expr) -> expr -> expr -> expr Source #

neqE :: Maybe (Sql92ExpressionQuantifierSyntax expr) -> expr -> expr -> expr Source #

ltE :: Maybe (Sql92ExpressionQuantifierSyntax expr) -> expr -> expr -> expr Source #

gtE :: Maybe (Sql92ExpressionQuantifierSyntax expr) -> expr -> expr -> expr Source #

leE :: Maybe (Sql92ExpressionQuantifierSyntax expr) -> expr -> expr -> expr Source #

geE :: Maybe (Sql92ExpressionQuantifierSyntax expr) -> expr -> expr -> expr Source #

eqMaybeE :: expr -> expr -> expr -> expr Source #

Compare the first and second argument for nullable equality, if they are both not null, return the result of the third expression

Some backends, like beam-postgres totally ignore the third result, because all equality there is sensible.

neqMaybeE :: expr -> expr -> expr -> expr Source #

Compare the first and second argument for nullable equality, if they are both not null, return the result of the third expression

Some backends, like beam-postgres totally ignore the third result, because all equality there is sensible.

castE :: expr -> Sql92ExpressionCastTargetSyntax expr -> expr Source #

notE :: expr -> expr Source #

negateE :: expr -> expr Source #

isNullE :: expr -> expr Source #

isNotNullE :: expr -> expr Source #

isTrueE :: expr -> expr Source #

isNotTrueE :: expr -> expr Source #

isFalseE :: expr -> expr Source #

isNotFalseE :: expr -> expr Source #

isUnknownE :: expr -> expr Source #

isNotUnknownE :: expr -> expr Source #

charLengthE :: expr -> expr Source #

octetLengthE :: expr -> expr Source #

bitLengthE :: expr -> expr Source #

lowerE :: expr -> expr Source #

upperE :: expr -> expr Source #

trimE :: expr -> expr Source #

absE :: expr -> expr Source #

Included so that we can easily write a Num instance, but not defined in SQL92. Implementations that do not support this, should use CASE .. WHEN ..

extractE :: Sql92ExpressionExtractFieldSyntax expr -> expr -> expr Source #

existsE :: Sql92ExpressionSelectSyntax expr -> expr Source #

uniqueE :: Sql92ExpressionSelectSyntax expr -> expr Source #

subqueryE :: Sql92ExpressionSelectSyntax expr -> expr Source #

currentTimestampE :: expr Source #

defaultE :: expr Source #

inE :: expr -> [expr] -> expr Source #

Instances

IsSql92ExpressionSyntax Expression Source # 

Methods

valueE :: Sql92ExpressionValueSyntax Expression -> Expression Source #

rowE :: [Expression] -> Expression Source #

quantifierListE :: [Expression] -> Expression Source #

coalesceE :: [Expression] -> Expression Source #

caseE :: [(Expression, Expression)] -> Expression -> Expression Source #

fieldE :: Sql92ExpressionFieldNameSyntax Expression -> Expression Source #

betweenE :: Expression -> Expression -> Expression -> Expression Source #

andE :: Expression -> Expression -> Expression Source #

orE :: Expression -> Expression -> Expression Source #

addE :: Expression -> Expression -> Expression Source #

subE :: Expression -> Expression -> Expression Source #

mulE :: Expression -> Expression -> Expression Source #

divE :: Expression -> Expression -> Expression Source #

likeE :: Expression -> Expression -> Expression Source #

modE :: Expression -> Expression -> Expression Source #

overlapsE :: Expression -> Expression -> Expression Source #

nullIfE :: Expression -> Expression -> Expression Source #

positionE :: Expression -> Expression -> Expression Source #

eqE :: Maybe (Sql92ExpressionQuantifierSyntax Expression) -> Expression -> Expression -> Expression Source #

neqE :: Maybe (Sql92ExpressionQuantifierSyntax Expression) -> Expression -> Expression -> Expression Source #

ltE :: Maybe (Sql92ExpressionQuantifierSyntax Expression) -> Expression -> Expression -> Expression Source #

gtE :: Maybe (Sql92ExpressionQuantifierSyntax Expression) -> Expression -> Expression -> Expression Source #

leE :: Maybe (Sql92ExpressionQuantifierSyntax Expression) -> Expression -> Expression -> Expression Source #

geE :: Maybe (Sql92ExpressionQuantifierSyntax Expression) -> Expression -> Expression -> Expression Source #

eqMaybeE :: Expression -> Expression -> Expression -> Expression Source #

neqMaybeE :: Expression -> Expression -> Expression -> Expression Source #

castE :: Expression -> Sql92ExpressionCastTargetSyntax Expression -> Expression Source #

notE :: Expression -> Expression Source #

negateE :: Expression -> Expression Source #

isNullE :: Expression -> Expression Source #

isNotNullE :: Expression -> Expression Source #

isTrueE :: Expression -> Expression Source #

isNotTrueE :: Expression -> Expression Source #

isFalseE :: Expression -> Expression Source #

isNotFalseE :: Expression -> Expression Source #

isUnknownE :: Expression -> Expression Source #

isNotUnknownE :: Expression -> Expression Source #

charLengthE :: Expression -> Expression Source #

octetLengthE :: Expression -> Expression Source #

bitLengthE :: Expression -> Expression Source #

lowerE :: Expression -> Expression Source #

upperE :: Expression -> Expression Source #

trimE :: Expression -> Expression Source #

absE :: Expression -> Expression Source #

extractE :: Sql92ExpressionExtractFieldSyntax Expression -> Expression -> Expression Source #

existsE :: Sql92ExpressionSelectSyntax Expression -> Expression Source #

uniqueE :: Sql92ExpressionSelectSyntax Expression -> Expression Source #

subqueryE :: Sql92ExpressionSelectSyntax Expression -> Expression Source #

currentTimestampE :: Expression Source #

defaultE :: Expression Source #

inE :: Expression -> [Expression] -> Expression Source #

IsSql92ExpressionSyntax SqlSyntaxBuilder Source # 

Methods

valueE :: Sql92ExpressionValueSyntax SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

rowE :: [SqlSyntaxBuilder] -> SqlSyntaxBuilder Source #

quantifierListE :: [SqlSyntaxBuilder] -> SqlSyntaxBuilder Source #

coalesceE :: [SqlSyntaxBuilder] -> SqlSyntaxBuilder Source #

caseE :: [(SqlSyntaxBuilder, SqlSyntaxBuilder)] -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

fieldE :: Sql92ExpressionFieldNameSyntax SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

betweenE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

andE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

orE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

addE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

subE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

mulE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

divE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

likeE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

modE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

overlapsE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

nullIfE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

positionE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

eqE :: Maybe (Sql92ExpressionQuantifierSyntax SqlSyntaxBuilder) -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

neqE :: Maybe (Sql92ExpressionQuantifierSyntax SqlSyntaxBuilder) -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

ltE :: Maybe (Sql92ExpressionQuantifierSyntax SqlSyntaxBuilder) -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

gtE :: Maybe (Sql92ExpressionQuantifierSyntax SqlSyntaxBuilder) -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

leE :: Maybe (Sql92ExpressionQuantifierSyntax SqlSyntaxBuilder) -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

geE :: Maybe (Sql92ExpressionQuantifierSyntax SqlSyntaxBuilder) -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

eqMaybeE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

neqMaybeE :: SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

castE :: SqlSyntaxBuilder -> Sql92ExpressionCastTargetSyntax SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

notE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

negateE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isNullE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isNotNullE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isTrueE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isNotTrueE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isFalseE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isNotFalseE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isUnknownE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

isNotUnknownE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

charLengthE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

octetLengthE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

bitLengthE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

lowerE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

upperE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

trimE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

absE :: SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

extractE :: Sql92ExpressionExtractFieldSyntax SqlSyntaxBuilder -> SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

existsE :: Sql92ExpressionSelectSyntax SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

uniqueE :: Sql92ExpressionSelectSyntax SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

subqueryE :: Sql92ExpressionSelectSyntax SqlSyntaxBuilder -> SqlSyntaxBuilder Source #

currentTimestampE :: SqlSyntaxBuilder Source #

defaultE :: SqlSyntaxBuilder Source #

inE :: SqlSyntaxBuilder -> [SqlSyntaxBuilder] -> SqlSyntaxBuilder Source #

class IsSql92AggregationSetQuantifierSyntax (Sql92AggregationSetQuantifierSyntax expr) => IsSql92AggregationExpressionSyntax expr where Source #

Minimal complete definition

countAllE, countE, avgE, maxE, minE, sumE

Associated Types

type Sql92AggregationSetQuantifierSyntax expr :: * Source #

class (IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax from), IsSql92ExpressionSyntax (Sql92FromExpressionSyntax from)) => IsSql92FromSyntax from where Source #

Minimal complete definition

fromTable, innerJoin, leftJoin, rightJoin

Associated Types

type Sql92FromTableSourceSyntax from :: * Source #

type Sql92FromExpressionSyntax from :: * Source #

Methods

fromTable :: Sql92FromTableSourceSyntax from -> Maybe Text -> from Source #

innerJoin :: from -> from -> Maybe (Sql92FromExpressionSyntax from) -> from Source #

leftJoin :: from -> from -> Maybe (Sql92FromExpressionSyntax from) -> from Source #

rightJoin :: from -> from -> Maybe (Sql92FromExpressionSyntax from) -> from Source #

class IsSql92FromSyntax from => IsSql92FromOuterJoinSyntax from where Source #

Minimal complete definition

outerJoin

Methods

outerJoin :: from -> from -> Maybe (Sql92FromExpressionSyntax from) -> from Source #