1
Fork 0

add drop table support

This commit is contained in:
Jake Wheat 2015-08-02 23:27:09 +03:00
parent f0baa3c37b
commit 8291fbaa44
4 changed files with 29 additions and 16 deletions

View file

@ -1444,7 +1444,8 @@ TODO: change style
> [keyword_ "create" *> choice [createSchema
> ,createTable]
> ,keyword_ "alter" *> choice [alterTable]
> ,keyword_ "drop" *> choice [dropSchema]
> ,keyword_ "drop" *> choice [dropSchema
> ,dropTable]
> ,delete
> ,truncateSt
> ,insert
@ -1611,8 +1612,12 @@ slightly hacky parser for signed integers
> dropSchema :: Parser Statement
> dropSchema = keyword_ "schema" >>
> DropSchema <$> names
> <*> dropBehaviour
> DropSchema <$> names <*> dropBehaviour
> dropTable :: Parser Statement
> dropTable = keyword_ "table" >>
> DropTable <$> names <*> dropBehaviour
> delete :: Parser Statement
> delete = keywords_ ["delete","from"] >>

View file

@ -502,6 +502,9 @@ which have been changed to try to improve the layout of the output.
> sc (SetMultiple ts vs) = parens (commaSep $ map names ts) <+> text "="
> <+> parens (commaSep $ map (valueExpr d) vs)
> statement _ (DropTable n b) =
> text "drop" <+> text "table" <+> names n <+> dropBehav b
== access control
== transactions

View file

@ -401,16 +401,16 @@ I'm not sure if this is valid syntax or not.
> data Statement =
> -- ddl
> CreateSchema [Name] -- XXX
> | DropSchema [Name] DropBehaviour -- XXX
> CreateSchema [Name]
> | DropSchema [Name] DropBehaviour
> | CreateTable [Name] [TableElement]
> | AlterTable [Name] AlterTableAction
> {- | DropTable -- XXX
> | CreateView -- XXX
> | DropView -- XXX
> | CreateDomain -- XXX
> | DropTable [Name] DropBehaviour
> {- | CreateView
> | DropView
> | CreateDomain
> | AlterDomain
> | DropDomain -- XXX
> | DropDomain
> | CreateCharacterSet
> | DropCharacterSet
> | CreateCollation
@ -430,9 +430,9 @@ I'm not sure if this is valid syntax or not.
> | CreateOrdering
> | DropOrdering
> -- transforms
> | CreateSequence -- XXX
> | AlterSequence -- XXX
> | DropSequence -- XXX -}
> | CreateSequence
> | AlterSequence
> | DropSequence -}
> -- dml
> | SelectStatement QueryExpr
> {- | DeclareCursor

View file

@ -1032,9 +1032,14 @@ defintely skip
<drop table statement> ::=
DROP TABLE <table name> <drop behavior>
drop table t
drop table t cascade
drop table t restrict
> ,(TestStatement SQL2011
> "drop table t"
> $ DropTable [Name "t"] DefaultDropBehaviour)
> ,(TestStatement SQL2011
> "drop table t restrict"
> $ DropTable [Name "t"] Restrict)
11.32 <view definition>