|
Database.HaskellDB.DBSpec | Portability | non-portable | Stability | experimental | Maintainer | haskelldb-users@lists.sourceforge.net |
|
|
|
|
|
Description |
DBSpec is the new and improved way of specifying databases.
It is designed to be able to describe a database in such a
way that it can easily be converted to a DBDirect-spec OR
directly into a database
|
|
Synopsis |
|
|
|
Documentation |
|
data DBInfo |
Defines a database layout, top level
| Constructors | DBInfo | | dbname :: String | The name of the database
| opts :: DBOptions | Any options (i.e whether to use
Bounded Strings)
| tbls :: [TInfo] | Tables this database contains
|
|
| Instances | |
|
|
data TInfo |
Constructors | TInfo | | tname :: String | The name of the table
| cols :: [CInfo] | The columns in this table
|
|
| Instances | |
|
|
data CInfo |
Constructors | CInfo | | cname :: String | The name of this column
| descr :: FieldDesc | The description of this column
|
|
| Instances | |
|
|
data DBOptions |
Constructors | DBOptions | | useBString :: Bool | Use Bounded Strings?
|
|
| Instances | |
|
|
type FieldDesc = (FieldType, Bool) |
The type and nullable flag of a database column
|
|
data FieldType |
A database column type
| Constructors | StringT | | IntT | | IntegerT | | DoubleT | | BoolT | | CalendarTimeT | | BStrT Int | |
| Instances | |
|
|
makeDBSpec |
|
|
makeTInfo |
:: String | The table name
| -> [CInfo] | Columns
| -> TInfo | The generated TInfo
| Creates a TInfo
|
|
|
makeCInfo |
:: String | The column name
| -> FieldDesc | What the column contains
| -> CInfo | The generated CInfo
| Creates a CInfo
|
|
|
constructNonClashingDBInfo :: DBInfo -> DBInfo |
Constructs a DBInfo that doesn't cause nameclashes
|
|
ppDBInfo :: DBInfo -> Doc |
Pretty prints a DBInfo
|
|
ppTInfo :: TInfo -> Doc |
|
ppCInfo :: CInfo -> Doc |
|
ppDBOptions :: DBOptions -> Doc |
|
dbInfoToDoc :: DBInfo -> Doc |
Creates a valid declaration of a DBInfo. The variable name will be the
same as the database name
|
|
finalizeSpec :: DBInfo -> DBInfo |
Does a final touching up of a DBInfo before it is used by i.e DBDirect.
This converts any Bounded Strings to ordinary strings if that flag is set.
|
|
dbToDBSpec |
:: Bool | Use bounded strings?
| -> String | the name our database should have
| -> Database | the database connection
| -> IO DBInfo | return a DBInfo
| Connects to a database and generates a specification from it
|
|
|
dbSpecToDatabase |
:: Database | A Database
| -> DBInfo | The DBInfo to generate from
| -> IO () | | Converts a DBInfo to a real life Database, note that the database must
exist for this to work
|
|
|
Produced by Haddock version 0.8 |