1
Fork 0

add support for typenames with precision and scale

This commit is contained in:
Jake Wheat 2013-12-17 19:52:14 +02:00
parent 60d1b446db
commit 558d44140a
5 changed files with 31 additions and 8 deletions
tools/Language/SQL/SimpleSQL

View file

@ -220,13 +220,13 @@ sure which sql version they were introduced, 1999 or 2003 I think).
> \(R2,ROLLUP( MONTH(SALES_DATE), REGION ) ))\n\
> \ORDER BY GROUP, WEEK, DAY_WEEK, MONTH, REGION"-} -- as group - needs more subtle keyword blacklisting
> {-,"SELECT MONTH(SALES_DATE) AS MONTH,\n\
> ,"SELECT MONTH(SALES_DATE) AS MONTH,\n\
> \REGION,\n\
> \SUM(SALES) AS UNITS_SOLD,\n\
> \MAX(SALES) AS BEST_SALE,\n\
> \CAST(ROUND(AVG(DECIMAL(SALES)),2) AS DECIMAL(5,2)) AS AVG_UNITS_SOLD\n\
> \FROM SALES\n\
> \GROUP BY CUBE(MONTH(SALES_DATE),REGION)\n\
> \ORDER BY MONTH, REGION" -} -- needs typenames with precision
> \ORDER BY MONTH, REGION"
> ]

View file

@ -141,6 +141,13 @@ Tests for parsing scalar expressions
> ,("cast('1' as double precision)"
> ,Cast (StringLit "1") $ TypeName "double precision")
> ,("cast('1' as float(8))"
> ,Cast (StringLit "1") $ PrecTypeName "float" 8)
> ,("cast('1' as decimal(15,2))"
> ,Cast (StringLit "1") $ Prec2TypeName "decimal" 15 2)
> ,("double precision '3'"
> ,TypedLit (TypeName "double precision") "3")
> ]