@@ -125,6 +125,7 @@ numeric
@@ -187,6 +188,35 @@ renderElem byOid elemOid
187 Nothing -> error ("oid not found: " ++ show elemOid)
188 Nothing -> error ("oid not found: " ++ show elemOid)
188 Just x -> "Just " ++ bs (typname x)
189 Just x -> "Just " ++ bs (typname x)
191+renderTypeInfo :: OidMap -> TypeInfo -> TypeName -> Blaze.Builder
192+renderTypeInfo byOid info name
193+ | typcategory info == 'A' || typname info == "_record" =
194+ let (Just typelem_info) = Map.lookup (typelem info) byOid
195+ (Just typelem_hs_name) = lookup (typname typelem_info) typeNames
198+ , bs (hs name), " :: TypeInfo\n"
199+ , bs (hs name), " = Array {\n"
200+ , " typoid = ", fromString (show (typoid info)), ",\n"
201+ , " typcategory = '", Blaze.fromChar (typcategory info), "',\n"
202+ , " typdelim = '", Blaze.fromChar (typdelim info), "',\n"
203+ , " typname = \"", bs (typname info), "\",\n"
204+ , " typelem = ", bs typelem_hs_name, "\n"
207+ | typcategory info == 'R' = undefined
211+ , bs (hs name), " :: TypeInfo\n"
212+ , bs (hs name), " = Basic {\n"
213+ , " typoid = ", fromString (show (typoid info)), ",\n"
214+ , " typcategory = '", Blaze.fromChar (typcategory info), "',\n"
215+ , " typdelim = '", Blaze.fromChar (typdelim info), "',\n"
216+ , " typname = \"", bs (typname info), "\"\n"
190-- FIXME: add in any names that we need that we didn't specify, (i.e.
220-- FIXME: add in any names that we need that we didn't specify, (i.e.
191-- the "unknowns" in getTypeInfos
221-- the "unknowns" in getTypeInfos
192-- and munge them into a valid haskell identifier if needed.
222-- and munge them into a valid haskell identifier if needed.
@@ -237,15 +267,6 @@ staticTypeInfo (Oid x) = case x of
237 ++ [longstring|
267 ++ [longstring|
238 _ -> Nothing
268 _ -> Nothing
240− ++ concat [concat
270+ ++ concat [ renderTypeInfo byOid typeInfo name
242− , bs (hs name), " :: TypeInfo\n"
243− , bs (hs name), " = Basic {\n"
244− , " typoid = ", fromString (show typoid), ",\n"
245− , " typcategory = '", Blaze.fromChar typcategory, "',\n"
246− , " typdelim = '", Blaze.fromChar typdelim, "',\n"
247− , " typname = \"", bs typname, "\"\n"
250 | name <- getNames byName names
271 | name <- getNames byName names
251− , let (Just (TypeInfo{..})) = Map.lookup (pg name) byName])
272+ , let (Just typeInfo) = Map.lookup (pg name) byName])