From 8f8c59b064d6d6965800f571419f1944eb01a92e Mon Sep 17 00:00:00 2001 From: Kei Hibino Date: Tue, 26 Mar 2013 21:14:25 +0900 Subject: [PATCH] Renamed. --- schema-th/src/Database/HDBC/Schema/IBMDB2.hs | 2 +- .../HDBC/Schema/PgCatalog/PgAttribute.hs | 2 +- .../src/Database/HDBC/Schema/PgCatalog/PgType.hs | 2 +- schema-th/src/Database/HDBC/TH.hs | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/schema-th/src/Database/HDBC/Schema/IBMDB2.hs b/schema-th/src/Database/HDBC/Schema/IBMDB2.hs index 0e20de33..0f7d49c0 100644 --- a/schema-th/src/Database/HDBC/Schema/IBMDB2.hs +++ b/schema-th/src/Database/HDBC/Schema/IBMDB2.hs @@ -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 diff --git a/schema-th/src/Database/HDBC/Schema/PgCatalog/PgAttribute.hs b/schema-th/src/Database/HDBC/Schema/PgCatalog/PgAttribute.hs index 00cfc93d..e7957d63 100644 --- a/schema-th/src/Database/HDBC/Schema/PgCatalog/PgAttribute.hs +++ b/schema-th/src/Database/HDBC/Schema/PgCatalog/PgAttribute.hs @@ -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" [ diff --git a/schema-th/src/Database/HDBC/Schema/PgCatalog/PgType.hs b/schema-th/src/Database/HDBC/Schema/PgCatalog/PgType.hs index c9f233ab..da82cd44 100644 --- a/schema-th/src/Database/HDBC/Schema/PgCatalog/PgType.hs +++ b/schema-th/src/Database/HDBC/Schema/PgCatalog/PgType.hs @@ -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" [ diff --git a/schema-th/src/Database/HDBC/TH.hs b/schema-th/src/Database/HDBC/TH.hs index dcf35410..190250dc 100644 --- a/schema-th/src/Database/HDBC/TH.hs +++ b/schema-th/src/Database/HDBC/TH.hs @@ -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