quote column name

This commit is contained in:
Kazuki Okamoto 2016-06-11 22:41:01 +09:00
parent b6514c93bb
commit 72a684664e
2 changed files with 8 additions and 4 deletions

2
.gitignore vendored
View File

@ -15,3 +15,5 @@ cabal.sandbox.config
*.aux
*.hp
/.stack-work/
.idea/
*.iml

View File

@ -270,9 +270,11 @@ tableSQL normalize snm iq schema table = case snm of
normalizeT
| normalize = map toLower table
| otherwise = table
qt s = case iq of
NoQuotation -> s
Quotation qc -> qc : s ++ qc : [] -- TODO: Escaping.
qt = quote iq
quote :: IdentifierQuotation -> String -> String
quote NoQuotation s = s
quote (Quotation qc) s = qc : s ++ qc : [] -- TODO: Escaping.
derivationVarNameDefault :: String -> VarName
derivationVarNameDefault = (`varNameWithPrefix` "derivationFrom")
@ -336,7 +338,7 @@ defineTableTypesWithConfig config schema table columns = do
(table `varNameWithPrefix` "insertQuery")
(recordType recConfig schema table)
(tableSQL (normalizedTableName config) (schemaNameMode config) (identifierQuotation config) schema table)
(map (fst . fst) columns)
(map ((quote (identifierQuotation config)) . fst . fst) columns)
colsDs <- defineColumnsDefault (recordTypeName recConfig schema table) columns
return $ tableDs ++ colsDs