This commit is contained in:
Kei Hibino 2013-03-26 21:14:25 +09:00
parent e18c8f508c
commit 8f8c59b064
4 changed files with 11 additions and 11 deletions

View File

@ -36,7 +36,7 @@ import qualified Language.SQL.SqlWord as SQL
import Database.HDBC.Schema.Driver (Driver, getFields, getPrimaryKey, emptyDriver)
$(Base.defineTableDefault'
$(Base.defineRecordDefault
"SYSCAT" "columns"
[
-- column schema type length NULL

View File

@ -7,7 +7,7 @@ import Database.HDBC.SqlValueExtra ()
import Database.HDBC.TH (derivingShow)
import qualified Database.HDBC.TH as Base
$(Base.defineTableDefault
$(Base.defineRecordDefault
"PG_CATALOG" "pg_attribute"
[

View File

@ -7,7 +7,7 @@ import Database.HDBC.SqlValueExtra ()
import Database.HDBC.TH (derivingShow)
import qualified Database.HDBC.TH as Base
$(Base.defineTableDefault
$(Base.defineRecordDefault
"PG_CATALOG" "pg_type"
[

View File

@ -30,8 +30,8 @@ module Database.HDBC.TH (
definePersistableInstance,
defineRecordDecomposeFunction,
defineTable,
defineTableDefault',
defineRecord,
defineRecordDefault,
defineConstantSql,
defineSqlPrimarySelect,
@ -258,13 +258,13 @@ defineRecordDecomposeFunction funName' typeCon fields = do
[] ]
return [sig, var]
defineTable :: (VarName, VarName)
defineRecord :: (VarName, VarName)
-> (String, ConName)
-> (VarName, VarName, VarName)
-> [((VarName, TypeQ), String)]
-> [ConName]
-> Q [Dec]
defineTable
defineRecord
(cF, dF) (tableSQL, tyC)
(tableN, fldsN, widthN)
schemas' drvs = do
@ -281,15 +281,15 @@ defineTable
instSQL <- definePersistableInstance widthN typeCon cF dF width
return $ typ : fromSQL ++ toSQL ++ tableI ++ instSQL
defineTableDefault' :: String
defineRecordDefault :: String
-> String
-> [(String, TypeQ)]
-> [ConName]
-> Q [Dec]
defineTableDefault' schema table fields drives = do
defineRecordDefault schema table fields drives = do
let tableSQL = nameOfTableSQL schema table
fields' = map (uncurry fieldInfo) fields
defineTable
defineRecord
(table `varNameWithPrefix` "fromSqlOf",
table `varNameWithPrefix` "toSqlOf")
(tableSQL, recordTypeNameDefault table)
@ -401,7 +401,7 @@ defineTableDefault :: String
-> [ConName]
-> Q [Dec]
defineTableDefault schema table fields derives = do
recD <- defineTableDefault' schema table fields derives
recD <- defineRecordDefault schema table fields derives
sqlD <- defineSqlsDefault schema table fields
return $ recD ++ sqlD