1
Fork 0

refactor dialect into a non enum and separate to own file

This commit is contained in:
Jake Wheat 2016-02-12 12:51:06 +02:00
parent 2b73907119
commit 1b4eefc431
22 changed files with 304 additions and 252 deletions
Language/SQL/SimpleSQL

View file

@ -0,0 +1,51 @@
Data types to represent different dialect options
> {-# LANGUAGE DeriveDataTypeable #-}
> module Language.SQL.SimpleSQL.Dialect
> (SyntaxFlavour(..)
> ,Dialect(..)
> ,ansi2011
> ,mysql
> ,postgres
> ,oracle
> ,sqlserver
> ) where
> import Data.Data
hack for now, later will expand to flags on a feature by feature basis
> data SyntaxFlavour = ANSI2011
> | MySQL
> | Postgres
> | Oracle
> | SQLServer
> deriving (Eq,Show,Read,Data,Typeable)
> -- | Used to set the dialect used for parsing and pretty printing,
> -- very unfinished at the moment.
> data Dialect = Dialect {diSyntaxFlavour :: SyntaxFlavour}
> deriving (Eq,Show,Read,Data,Typeable)
> -- | ansi sql 2011 dialect
> ansi2011 :: Dialect
> ansi2011 = Dialect ANSI2011
> -- | mysql dialect
> mysql :: Dialect
> mysql = Dialect MySQL
> -- | postgresql dialect
> postgres :: Dialect
> postgres = Dialect Postgres
> -- | oracle dialect
> oracle :: Dialect
> oracle = Dialect Postgres
> -- | microsoft sql server dialect
> sqlserver :: Dialect
> sqlserver = Dialect Postgres