{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
module Language.SQL.SimpleSQL.Dialect
(Dialect(..)
,ansi2011
,mysql
,postgres
,oracle
,sqlserver
) where
import Data.Text (Text)
import Data.Data (Data,Typeable)
data Dialect = Dialect
{
Dialect -> [Text]
diKeywords :: [Text]
,Dialect -> [Text]
diIdentifierKeywords :: [Text]
,Dialect -> [Text]
diAppKeywords :: [Text]
,Dialect -> [Text]
diSpecialTypeNames :: [Text]
,Dialect -> Bool
diFetchFirst :: Bool
,Dialect -> Bool
diLimit :: Bool
,Dialect -> Bool
diOdbc :: Bool
,Dialect -> Bool
diBackquotedIden :: Bool
,Dialect -> Bool
diSquareBracketQuotedIden :: Bool
,Dialect -> Bool
diAtIdentifier :: Bool
,Dialect -> Bool
diHashIdentifier :: Bool
,Dialect -> Bool
diPositionalArg :: Bool
,Dialect -> Bool
diDollarString :: Bool
,Dialect -> Bool
diEString :: Bool
,Dialect -> Bool
diPostgresSymbols :: Bool
,Dialect -> Bool
diSqlServerSymbols :: Bool
,Dialect -> Bool
diConvertFunction :: Bool
,Dialect -> Bool
diAutoincrement :: Bool
,Dialect -> Bool
diNonCommaSeparatedConstraints :: Bool
,Dialect -> Bool
diWithoutRowidTables :: Bool
,Dialect -> Bool
diOptionalColumnTypes :: Bool
,Dialect -> Bool
diDefaultClausesAsConstraints :: Bool
}
deriving (Dialect -> Dialect -> Bool
(Dialect -> Dialect -> Bool)
-> (Dialect -> Dialect -> Bool) -> Eq Dialect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Dialect -> Dialect -> Bool
== :: Dialect -> Dialect -> Bool
$c/= :: Dialect -> Dialect -> Bool
/= :: Dialect -> Dialect -> Bool
Eq,Int -> Dialect -> ShowS
[Dialect] -> ShowS
Dialect -> String
(Int -> Dialect -> ShowS)
-> (Dialect -> String) -> ([Dialect] -> ShowS) -> Show Dialect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Dialect -> ShowS
showsPrec :: Int -> Dialect -> ShowS
$cshow :: Dialect -> String
show :: Dialect -> String
$cshowList :: [Dialect] -> ShowS
showList :: [Dialect] -> ShowS
Show,ReadPrec [Dialect]
ReadPrec Dialect
Int -> ReadS Dialect
ReadS [Dialect]
(Int -> ReadS Dialect)
-> ReadS [Dialect]
-> ReadPrec Dialect
-> ReadPrec [Dialect]
-> Read Dialect
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Dialect
readsPrec :: Int -> ReadS Dialect
$creadList :: ReadS [Dialect]
readList :: ReadS [Dialect]
$creadPrec :: ReadPrec Dialect
readPrec :: ReadPrec Dialect
$creadListPrec :: ReadPrec [Dialect]
readListPrec :: ReadPrec [Dialect]
Read,Typeable Dialect
Typeable Dialect =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Dialect -> c Dialect)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Dialect)
-> (Dialect -> Constr)
-> (Dialect -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Dialect))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Dialect))
-> ((forall b. Data b => b -> b) -> Dialect -> Dialect)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r)
-> (forall u. (forall d. Data d => d -> u) -> Dialect -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Dialect -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect)
-> Data Dialect
Dialect -> Constr
Dialect -> DataType
(forall b. Data b => b -> b) -> Dialect -> Dialect
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Dialect -> u
forall u. (forall d. Data d => d -> u) -> Dialect -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Dialect
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Dialect -> c Dialect
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Dialect)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Dialect)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Dialect -> c Dialect
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Dialect -> c Dialect
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Dialect
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Dialect
$ctoConstr :: Dialect -> Constr
toConstr :: Dialect -> Constr
$cdataTypeOf :: Dialect -> DataType
dataTypeOf :: Dialect -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Dialect)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Dialect)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Dialect)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Dialect)
$cgmapT :: (forall b. Data b => b -> b) -> Dialect -> Dialect
gmapT :: (forall b. Data b => b -> b) -> Dialect -> Dialect
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Dialect -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Dialect -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Dialect -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Dialect -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Dialect -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Dialect -> m Dialect
Data,Typeable)
ansi2011 :: Dialect
ansi2011 :: Dialect
ansi2011 = Dialect {diKeywords :: [Text]
diKeywords = [Text]
ansi2011ReservedKeywords
,diIdentifierKeywords :: [Text]
diIdentifierKeywords = []
,diAppKeywords :: [Text]
diAppKeywords = [Text
"set"]
,diSpecialTypeNames :: [Text]
diSpecialTypeNames = [Text]
ansi2011TypeNames
,diFetchFirst :: Bool
diFetchFirst = Bool
True
,diLimit :: Bool
diLimit = Bool
False
,diOdbc :: Bool
diOdbc = Bool
False
,diBackquotedIden :: Bool
diBackquotedIden = Bool
False
,diSquareBracketQuotedIden :: Bool
diSquareBracketQuotedIden = Bool
False
,diAtIdentifier :: Bool
diAtIdentifier = Bool
False
,diHashIdentifier :: Bool
diHashIdentifier = Bool
False
,diPositionalArg :: Bool
diPositionalArg = Bool
False
,diDollarString :: Bool
diDollarString = Bool
False
,diEString :: Bool
diEString = Bool
False
,diPostgresSymbols :: Bool
diPostgresSymbols = Bool
False
,diSqlServerSymbols :: Bool
diSqlServerSymbols = Bool
False
,diConvertFunction :: Bool
diConvertFunction = Bool
False
,diAutoincrement :: Bool
diAutoincrement = Bool
False
,diNonCommaSeparatedConstraints :: Bool
diNonCommaSeparatedConstraints = Bool
False
,diWithoutRowidTables :: Bool
diWithoutRowidTables = Bool
False
,diOptionalColumnTypes :: Bool
diOptionalColumnTypes = Bool
False
,diDefaultClausesAsConstraints :: Bool
diDefaultClausesAsConstraints = Bool
False
}
mysql :: Dialect
mysql :: Dialect
mysql = Dialect -> Dialect
addLimit Dialect
ansi2011 {diFetchFirst = False
,diBackquotedIden = True
}
postgres :: Dialect
postgres :: Dialect
postgres = Dialect -> Dialect
addLimit Dialect
ansi2011 {diPositionalArg = True
,diDollarString = True
,diEString = True
,diPostgresSymbols = True}
oracle :: Dialect
oracle :: Dialect
oracle = Dialect
ansi2011
sqlserver :: Dialect
sqlserver :: Dialect
sqlserver = Dialect
ansi2011 {diSquareBracketQuotedIden = True
,diAtIdentifier = True
,diHashIdentifier = True
,diOdbc = True
,diSqlServerSymbols = True
,diConvertFunction = True}
addLimit :: Dialect -> Dialect
addLimit :: Dialect -> Dialect
addLimit Dialect
d = Dialect
d {diKeywords = "limit": diKeywords d
,diLimit = True}
ansi2011ReservedKeywords :: [Text]
ansi2011ReservedKeywords :: [Text]
ansi2011ReservedKeywords =
[
Text
"all"
,Text
"allocate"
,Text
"alter"
,Text
"and"
,Text
"are"
,Text
"array"
,Text
"as"
,Text
"asensitive"
,Text
"asymmetric"
,Text
"at"
,Text
"atomic"
,Text
"authorization"
,Text
"begin"
,Text
"between"
,Text
"bigint"
,Text
"binary"
,Text
"blob"
,Text
"boolean"
,Text
"both"
,Text
"by"
,Text
"call"
,Text
"called"
,Text
"cascaded"
,Text
"case"
,Text
"cast"
,Text
"char"
,Text
"character"
,Text
"check"
,Text
"clob"
,Text
"close"
,Text
"collate"
,Text
"column"
,Text
"commit"
,Text
"condition"
,Text
"connect"
,Text
"constraint"
,Text
"corresponding"
,Text
"create"
,Text
"cross"
,Text
"cube"
,Text
"current"
,Text
"cursor"
,Text
"cycle"
,Text
"date"
,Text
"deallocate"
,Text
"dec"
,Text
"decimal"
,Text
"declare"
,Text
"delete"
,Text
"deref"
,Text
"describe"
,Text
"deterministic"
,Text
"disconnect"
,Text
"distinct"
,Text
"double"
,Text
"drop"
,Text
"dynamic"
,Text
"each"
,Text
"else"
,Text
"end"
,Text
"end-exec"
,Text
"equals"
,Text
"escape"
,Text
"except"
,Text
"exec"
,Text
"execute"
,Text
"exists"
,Text
"exp"
,Text
"external"
,Text
"extract"
,Text
"fetch"
,Text
"filter"
,Text
"float"
,Text
"for"
,Text
"foreign"
,Text
"free"
,Text
"from"
,Text
"full"
,Text
"function"
,Text
"get"
,Text
"global"
,Text
"grant"
,Text
"group"
,Text
"groups"
,Text
"having"
,Text
"hold"
,Text
"identity"
,Text
"in"
,Text
"indicator"
,Text
"inner"
,Text
"inout"
,Text
"insensitive"
,Text
"insert"
,Text
"int"
,Text
"integer"
,Text
"intersect"
,Text
"interval"
,Text
"into"
,Text
"is"
,Text
"join"
,Text
"language"
,Text
"large"
,Text
"lateral"
,Text
"leading"
,Text
"left"
,Text
"like"
,Text
"like_regex"
,Text
"local"
,Text
"localtime"
,Text
"localtimestamp"
,Text
"match"
,Text
"member"
,Text
"merge"
,Text
"method"
,Text
"modifies"
,Text
"multiset"
,Text
"national"
,Text
"natural"
,Text
"nchar"
,Text
"nclob"
,Text
"new"
,Text
"no"
,Text
"none"
,Text
"normalize"
,Text
"not"
,Text
"ntile"
,Text
"numeric"
,Text
"octet_length"
,Text
"occurrences_regex"
,Text
"of"
,Text
"offset"
,Text
"old"
,Text
"on"
,Text
"only"
,Text
"open"
,Text
"or"
,Text
"order"
,Text
"out"
,Text
"outer"
,Text
"over"
,Text
"overlaps"
,Text
"overlay"
,Text
"parameter"
,Text
"partition"
,Text
"percent"
,Text
"period"
,Text
"portion"
,Text
"position"
,Text
"position_regex"
,Text
"precedes"
,Text
"precision"
,Text
"prepare"
,Text
"primary"
,Text
"procedure"
,Text
"range"
,Text
"reads"
,Text
"real"
,Text
"recursive"
,Text
"ref"
,Text
"references"
,Text
"referencing"
,Text
"release"
,Text
"result"
,Text
"return"
,Text
"returns"
,Text
"revoke"
,Text
"right"
,Text
"rollback"
,Text
"rollup"
,Text
"rows"
,Text
"savepoint"
,Text
"scope"
,Text
"scroll"
,Text
"search"
,Text
"select"
,Text
"sensitive"
,Text
"set"
,Text
"similar"
,Text
"smallint"
,Text
"specific"
,Text
"specifictype"
,Text
"sql"
,Text
"sqlexception"
,Text
"sqlstate"
,Text
"sqlwarning"
,Text
"static"
,Text
"submultiset"
,Text
"substring_regex"
,Text
"succeeds"
,Text
"symmetric"
,Text
"system"
,Text
"table"
,Text
"tablesample"
,Text
"then"
,Text
"time"
,Text
"timestamp"
,Text
"timezone_hour"
,Text
"timezone_minute"
,Text
"to"
,Text
"trailing"
,Text
"translate"
,Text
"translate_regex"
,Text
"translation"
,Text
"treat"
,Text
"trigger"
,Text
"truncate"
,Text
"uescape"
,Text
"union"
,Text
"unique"
,Text
"unnest"
,Text
"update"
,Text
"upper"
,Text
"using"
,Text
"values"
,Text
"value_of"
,Text
"varbinary"
,Text
"varchar"
,Text
"varying"
,Text
"versioning"
,Text
"when"
,Text
"whenever"
,Text
"where"
,Text
"window"
,Text
"with"
,Text
"within"
,Text
"without"
]
ansi2011TypeNames :: [Text]
ansi2011TypeNames :: [Text]
ansi2011TypeNames =
[Text
"double precision"
,Text
"character varying"
,Text
"char varying"
,Text
"character large object"
,Text
"char large object"
,Text
"national character"
,Text
"national char"
,Text
"national character varying"
,Text
"national char varying"
,Text
"national character large object"
,Text
"nchar large object"
,Text
"nchar varying"
,Text
"bit varying"
,Text
"binary large object"
,Text
"binary varying"
,Text
"array"
,Text
"bigint"
,Text
"binary"
,Text
"blob"
,Text
"boolean"
,Text
"char"
,Text
"character"
,Text
"clob"
,Text
"date"
,Text
"dec"
,Text
"decimal"
,Text
"double"
,Text
"float"
,Text
"int"
,Text
"integer"
,Text
"nchar"
,Text
"nclob"
,Text
"numeric"
,Text
"real"
,Text
"smallint"
,Text
"time"
,Text
"timestamp"
,Text
"varchar"
,Text
"varbinary"
]