1
Fork 0

remove ref typename for consistency

support t and p multipliers in lob lengths
update a few tests
This commit is contained in:
Jake Wheat 2014-04-20 19:24:03 +03:00
parent c50b3e7839
commit 9b2ba2fb36
7 changed files with 114 additions and 98 deletions
Language/SQL/SimpleSQL

View file

@ -420,7 +420,7 @@ TODO: this code needs heavy refactoring
> typeName :: Parser TypeName
> typeName =
> (rowTypeName <|> intervalTypeName <|> ref <|> otherTypeName)
> (rowTypeName <|> intervalTypeName <|> otherTypeName)
> >>= tnSuffix
> <?> "typename"
> where
@ -432,11 +432,6 @@ TODO: this code needs 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
@ -478,6 +473,8 @@ TODO: this code needs heavy refactoring
> x <- choice [Just LobK <$ keyword_ "k"
> ,Just LobM <$ keyword_ "m"
> ,Just LobG <$ keyword_ "g"
> ,Just LobT <$ keyword_ "t"
> ,Just LobP <$ keyword_ "p"
> ,return Nothing]
> return (p,x)
> lobUnits = choice [LobCharacters <$ keyword_ "characters"

View file

@ -263,7 +263,9 @@ which have been changed to try to improve the layout of the output.
> <> me (\x -> case x of
> LobK -> text "K"
> LobM -> text "M"
> LobG -> text "G") m
> LobG -> text "G"
> LobT -> text "T"
> LobP -> text "P") m
> <+> me (\x -> case x of
> LobCharacters -> text "CHARACTERS"
> LobOctets -> text "OCTETS") u)
@ -297,11 +299,6 @@ 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

View file

@ -167,8 +167,6 @@
> | UQName String
> deriving (Eq,Show,Read,Data,Typeable)
TODO: add ref and scope, any others?
> -- | Represents a type name, used in casts.
> data TypeName
> = TypeName [Name]
@ -182,13 +180,12 @@ 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))
> deriving (Eq,Show,Read,Data,Typeable)
> data LobMultiplier = LobK | LobM | LobG
> data LobMultiplier = LobK | LobM | LobG | LobT | LobP
> deriving (Eq,Show,Read,Data,Typeable)
> data LobUnits = LobCharacters
> | LobOctets