| Portability | non-portable |
|---|---|
| Stability | experimental |
| Maintainer | haskelldb-users@lists.sourceforge.net |
| Safe Haskell | None |
Database.HaskellDB.DBSpec
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
- data DBInfo = DBInfo {}
- data TInfo = TInfo {}
- data CInfo = CInfo {}
- data DBOptions = DBOptions {}
- type FieldDesc = (FieldType, Bool)
- data FieldType
- = StringT
- | IntT
- | IntegerT
- | DoubleT
- | BoolT
- | CalendarTimeT
- | LocalTimeT
- | BStrT Int
- makeDBSpec :: String -> DBOptions -> [TInfo] -> DBInfo
- makeTInfo :: String -> [CInfo] -> TInfo
- makeCInfo :: String -> FieldDesc -> CInfo
- constructNonClashingDBInfo :: DBInfo -> DBInfo
- ppDBInfo :: DBInfo -> Doc
- ppTInfo :: TInfo -> Doc
- ppCInfo :: CInfo -> Doc
- ppDBOptions :: DBOptions -> Doc
- dbInfoToDoc :: DBInfo -> Doc
- finalizeSpec :: DBInfo -> DBInfo
- dbToDBSpec :: Bool -> MakeIdentifiers -> String -> Database -> IO DBInfo
- dbSpecToDatabase :: Database -> DBInfo -> IO ()
Documentation
Defines a database layout, top level
Constructors
| DBInfo | |
Constructors
| TInfo | |
Constructors
| CInfo | |
Constructors
| DBOptions | |
Fields
| |
A database column type
Constructors
| StringT | |
| IntT | |
| IntegerT | |
| DoubleT | |
| BoolT | |
| CalendarTimeT | |
| LocalTimeT | |
| BStrT Int |
Arguments
| :: String | The name of the Database |
| -> DBOptions | Options |
| -> [TInfo] | Tables |
| -> DBInfo | The generated DBInfo |
Creates a DBInfo
Creates a TInfo
Creates a CInfo
constructNonClashingDBInfo :: DBInfo -> DBInfoSource
Constructs a DBInfo that doesn't cause nameclashes
ppDBOptions :: DBOptions -> DocSource
dbInfoToDoc :: DBInfo -> DocSource
Creates a valid declaration of a DBInfo. The variable name will be the same as the database name
finalizeSpec :: DBInfo -> DBInfoSource
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.
Arguments
| :: Bool | Use bounded strings? |
| -> MakeIdentifiers | style of generated Haskell identifiers, cOLUMN_NAME vs. columnName |
| -> 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
Converts a DBInfo to a real life Database, note that the database must exist for this to work