implement reference type name (I think - cannot find any examples or
explanation of what it means, didn't try reading the standard itself, just the grammar)
This commit is contained in:
parent
3b86a06e5c
commit
7a84704516
4 changed files with 15 additions and 3 deletions
Language/SQL/SimpleSQL
|
@ -530,7 +530,7 @@ TODO: this need heavy refactoring
|
|||
|
||||
> typeName :: Parser TypeName
|
||||
> typeName =
|
||||
> (rowTypeName <|> intervalTypeName <|> otherTypeName)
|
||||
> (rowTypeName <|> intervalTypeName <|> ref <|> otherTypeName)
|
||||
> >>= tnSuffix
|
||||
> <?> "typename"
|
||||
> where
|
||||
|
@ -542,6 +542,11 @@ TODO: this need heavy refactoring
|
|||
> intervalTypeName =
|
||||
> keyword_ "interval" >>
|
||||
> uncurry IntervalTypeName <$> intervalQualifier
|
||||
> ref =
|
||||
> keyword_ "ref" >>
|
||||
> RefTypeName
|
||||
> <$> parens (names)
|
||||
> <*> optionMaybe (keyword_ "scope" *> names)
|
||||
> -- other type names, which includes:
|
||||
> -- precision, scale, lob scale and units, timezone, character
|
||||
> -- set and collations
|
||||
|
|
|
@ -284,6 +284,11 @@ which have been changed to try to improve the layout of the output.
|
|||
> typeName (MultisetTypeName tn) =
|
||||
> typeName tn <+> text "multiset"
|
||||
|
||||
> typeName (RefTypeName rt sc) =
|
||||
> text "ref"
|
||||
> <> parens (names rt)
|
||||
> <+> me (\x -> text "scope" <+> names x) sc
|
||||
|
||||
> intervalTypeField :: IntervalTypeField -> Doc
|
||||
> intervalTypeField (Itf n p) =
|
||||
> text n
|
||||
|
|
|
@ -174,6 +174,7 @@ TODO: add ref and scope, any others?
|
|||
> | IntervalTypeName IntervalTypeField (Maybe IntervalTypeField)
|
||||
> | ArrayTypeName TypeName (Maybe Integer)
|
||||
> | MultisetTypeName TypeName
|
||||
> | RefTypeName [Name] (Maybe [Name])
|
||||
> deriving (Eq,Show,Read,Data,Typeable)
|
||||
|
||||
> data IntervalTypeField = Itf String (Maybe (Integer, Maybe Integer))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue