Portability | Basic embedding of SQL types in Haskell. |
---|---|
Stability | provisional |
Maintainer | Don Stewart <[email protected]> |
Database.SQL.Types
Description
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
- = SQLCreateDB DatabaseName
- | SQLCreateTable (Table a)
- data SQLDrop
- data Clause
- = IsNullable Bool
- | DefaultValue String
- | PrimaryKey Bool
- | ForeignKey TableName [ColumnName]
- | Clustered Bool
- | Unique
- 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
- 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 = StringSource
type DatabaseName = StringSource
Data type for SQL SELECT statements.
data SelectSource Source
Constructors
From TableSource [Join] |
Join with another table.
data TableSource Source
Use empty string for no alias.
Expressions in SQL statements.
Data type for SQL UPDATE statements.
Constructors
SQLUpdate TableName [(ColumnName, SQLExpr)] [SQLExpr] |
Data type for SQL DELETE statements.
Data type for SQL INSERT statements.
Constructors
SQLInsert TableName [ColumnName] [SQLExpr] | |
SQLInsertQuery TableName [ColumnName] SQLSelect |
Data type for SQL CREATE statements.
Constructors
SQLCreateDB DatabaseName | Create a database |
SQLCreateTable (Table a) | Create a table |
Data type representing the SQL DROP statement.
Constructors
SQLDropDB DatabaseName | Delete a database |
SQLDropTable TableName | Delete a table named SQLTable |
Constructors
IsNullable Bool | |
DefaultValue String | |
PrimaryKey Bool | Auto-increment? |
ForeignKey TableName [ColumnName] | |
Clustered Bool | |
Unique |
data Constraint Source
Constructors
TablePrimaryKey [ColumnName] | |
TableUnique [ColumnName] | |
TableCheck SQLExpr |
Constructors
Table | |
Fields
| |
VirtualTable | |
Fields
|
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.)
Constructors
Column | |
Fields
|
MySQL slanted, but also SQLite friendly if you don't get too fancy..
Constructors
TinyBlob | |
NormalBlob (Maybe Int) | |
MediumBlob | |
LongBlob |
showClause :: Clause -> StringSource
toSQLString :: String -> StringSource
export_sql :: PrettySQL t => t -> StringSource