add basic transction control
This commit is contained in:
parent
a9d51d1ebb
commit
666d1f877f
4 changed files with 89 additions and 7 deletions
Language/SQL/SimpleSQL
|
@ -1458,6 +1458,11 @@ TODO: change style
|
|||
> ,truncateSt
|
||||
> ,insert
|
||||
> ,update
|
||||
> ,startTransaction
|
||||
> ,savepoint
|
||||
> ,releaseSavepoint
|
||||
> ,commit
|
||||
> ,rollback
|
||||
> ,SelectStatement <$> queryExpr
|
||||
> ]
|
||||
|
||||
|
@ -1752,6 +1757,28 @@ slightly hacky parser for signed integers
|
|||
> (Restrict <$ keyword_ "restrict"
|
||||
> <|> Cascade <$ keyword_ "cascade")
|
||||
|
||||
-----------------------------
|
||||
|
||||
= access control
|
||||
|
||||
> startTransaction :: Parser Statement
|
||||
> startTransaction = StartTransaction <$ keywords_ ["start","transaction"]
|
||||
|
||||
> savepoint :: Parser Statement
|
||||
> savepoint = keyword_ "savepoint" >>
|
||||
> Savepoint <$> name
|
||||
|
||||
> releaseSavepoint :: Parser Statement
|
||||
> releaseSavepoint = keywords_ ["release","savepoint"] >>
|
||||
> ReleaseSavepoint <$> name
|
||||
|
||||
> commit :: Parser Statement
|
||||
> commit = Commit <$ keyword_ "commit" <* optional (keyword_ "work")
|
||||
|
||||
> rollback :: Parser Statement
|
||||
> rollback = keyword_ "rollback" >> optional (keyword_ "work") >>
|
||||
> Rollback <$> optionMaybe (keywords_ ["to", "savepoint"] *> name)
|
||||
|
||||
----------------------------
|
||||
|
||||
wrapper to parse a series of statements. They must be separated by
|
||||
|
|
|
@ -562,6 +562,22 @@ which have been changed to try to improve the layout of the output.
|
|||
|
||||
== access control
|
||||
|
||||
> statement _ StartTransaction =
|
||||
> texts ["start", "transaction"]
|
||||
|
||||
> statement _ (Savepoint nm) =
|
||||
> text "savepoint" <+> name nm
|
||||
|
||||
> statement _ (ReleaseSavepoint nm) =
|
||||
> texts ["release", "savepoint"] <+> name nm
|
||||
|
||||
> statement _ Commit =
|
||||
> text "commit"
|
||||
|
||||
> statement _ (Rollback mn) =
|
||||
> text "rollback"
|
||||
> <+> maybe empty (\n -> texts ["to","savepoint"] <+> name n) mn
|
||||
|
||||
== transactions
|
||||
|
||||
== sessions
|
||||
|
|
|
@ -465,12 +465,13 @@ I'm not sure if this is valid syntax or not.
|
|||
> | RevokePrivilege
|
||||
> | RevokeRole -}
|
||||
> -- transaction management
|
||||
> {- | StartTransaction
|
||||
> | SetTransaction
|
||||
> | SetContraints
|
||||
> | SavePoint
|
||||
> | ReleaseSavePoint
|
||||
> | Rollback -}
|
||||
> | StartTransaction
|
||||
> -- | SetTransaction
|
||||
> -- | SetContraints
|
||||
> | Savepoint Name
|
||||
> | ReleaseSavepoint Name
|
||||
> | Commit
|
||||
> | Rollback (Maybe Name)
|
||||
> -- session
|
||||
> {- | SetSessionCharacteristics
|
||||
> | SetSessionAuthorization
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue