Copyright | (c) Galois Inc. 2007 (c) figo GmbH 2016 |
---|---|
License | BSD3 |
Maintainer | figo GmbH <package+haskell@figo.io> |
Stability | provisional |
Portability | Basic embedding of SQL types in Haskell. |
Safe Haskell | None |
Language | Haskell98 |
Note: the quary part of this modules was imported (with modifications) from the lowest layer of abstraction of HaskellDB.
- type TableName = String
- type ColumnName = String
- type DatabaseName = String
- type OpName = String
- data SQLOrder
- data SQLSelect
- select_all :: SelectSource -> SQLSelect
- data SelectSource = From TableSource [Join]
- data Join = Join OpName TableSource (Maybe (OpName, SQLExpr))
- data TableSource
- data SQLExpr
- data SQLUpdate = SQLUpdate TableName [(ColumnName, SQLExpr)] [SQLExpr]
- data SQLDelete = SQLDelete TableName [SQLExpr]
- data SQLInsert
- data SQLCreate a
- data SQLDrop
- data Clause
- data ForeignUpdateCondition
- data ForeignUpdateAction
- = SetNull
- | SetDefault
- | Cascade
- | Restrict
- | NoAction
- data Deferment
- data Constraint
- data Table a
- = Table {
- tabName :: String
- tabColumns :: [Column a]
- tabConstraints :: [Constraint]
- | VirtualTable {
- tabName :: String
- tabColumns :: [Column a]
- tabConstraints :: [Constraint]
- tabUsing :: String
- = Table {
- data Column a = Column {
- colName :: ColumnName
- colType :: a
- colClauses :: [Clause]
- type SQLTable = Table SQLType
- data SQLType
- = SQLBoolean
- | SQLChar (Maybe Int)
- | SQLVarChar Int
- | SQLBlob BlobType
- | SQLDateTime DateTimeType
- | SQLInt IntType Bool Bool
- | SQLDecimal (Maybe Int) (Maybe Int)
- | SQLFloat (Maybe Int) (Maybe Int)
- data IntType
- data DateTimeType
- data BlobType
- = TinyBlob
- | NormalBlob (Maybe Int)
- | MediumBlob
- | LongBlob
- showType :: SQLType -> String
- showClause :: Clause -> String
- toSQLString :: String -> String
- export_sql :: PrettySQL t => t -> String
- class PrettySQL t where
Documentation
type ColumnName = String Source #
type DatabaseName = String Source #
select_all :: SelectSource -> SQLSelect Source #
data SelectSource Source #
data TableSource Source #
Use empty string for no alias.
Expressions in SQL statements.
Data type for SQL UPDATE statements.
SQLUpdate TableName [(ColumnName, SQLExpr)] [SQLExpr] |
Data type for SQL DELETE statements.
Data type for SQL INSERT statements.
Data type for SQL CREATE statements.
SQLCreateDB DatabaseName | Create a database |
SQLCreateTable (Table a) | Create a table |
Data type representing the SQL DROP statement.
SQLDropDB DatabaseName | Delete a database |
SQLDropTable TableName | Delete a table named SQLTable |
IsNullable Bool | |
DefaultValue String | |
PrimaryKey Bool | Auto-increment? |
ForeignKey TableName [ColumnName] [ForeignUpdateCondition] (Maybe Deferment) | |
Clustered Bool | |
Unique |
Table | |
| |
VirtualTable | |
|
We parameterize over column type, since SQL engines do tend to provide their own set of supported datatypes (which may or may not map onto SQL99's set of types.)
Column | |
|
MySQL slanted, but also SQLite friendly if you don't get too fancy..
showClause :: Clause -> String Source #
toSQLString :: String -> String Source #
export_sql :: PrettySQL t => t -> String Source #