mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-01 22:02:07 +03:00
Generate persistable templates from type name TH symbol.
This commit is contained in:
parent
14d909620c
commit
4abbc37309
@ -14,7 +14,6 @@ module Database.HDBC.Schema.SQLServer (
|
||||
driverSQLServer,
|
||||
) where
|
||||
|
||||
import qualified Database.Relational.Query.Table as Table
|
||||
import qualified Database.Relational.Schema.SQLServerSyscat.Columns as Columns
|
||||
import qualified Database.Relational.Schema.SQLServerSyscat.Types as Types
|
||||
import qualified Language.Haskell.TH.Lib.Extra as TH
|
||||
@ -25,18 +24,18 @@ import Database.HDBC (IConnection, SqlValue)
|
||||
import Database.HDBC.Record.Query (runQuery')
|
||||
import Database.HDBC.Record.Persistable ()
|
||||
import Database.HDBC.Schema.Driver (TypeMap, Driver, getFieldsWithMap, getPrimaryKey, emptyDriver)
|
||||
import Database.Record.TH (defineRecordWithSqlTypeDefaultFromDefined)
|
||||
import Database.Record.TH (makeRecordPersistableWithSqlTypeDefaultFromDefined)
|
||||
import Database.Relational.Schema.SQLServer (columnTypeQuerySQL, getType, normalizeColumn,
|
||||
notNull, primaryKeyQuerySQL)
|
||||
import Database.Relational.Schema.SQLServerSyscat.Columns (Columns(Columns))
|
||||
import Database.Relational.Schema.SQLServerSyscat.Types (Types(Types))
|
||||
import Database.Relational.Schema.SQLServerSyscat.Columns (Columns)
|
||||
import Database.Relational.Schema.SQLServerSyscat.Types (Types)
|
||||
import Language.Haskell.TH (TypeQ)
|
||||
|
||||
$(defineRecordWithSqlTypeDefaultFromDefined
|
||||
[t| SqlValue |] (Table.shortName Columns.tableOfColumns))
|
||||
$(makeRecordPersistableWithSqlTypeDefaultFromDefined
|
||||
[t| SqlValue |] ''Columns)
|
||||
|
||||
$(defineRecordWithSqlTypeDefaultFromDefined
|
||||
[t| SqlValue |] (Table.shortName Types.tableOfTypes))
|
||||
$(makeRecordPersistableWithSqlTypeDefaultFromDefined
|
||||
[t| SqlValue |] ''Types)
|
||||
|
||||
logPrefix :: String -> String
|
||||
logPrefix = ("SQLServer: " ++)
|
||||
|
Loading…
Reference in New Issue
Block a user