@@ -4743,6 +4743,10 @@ pub enum Statement {
47434743 ///
47444744 /// See: <https://learn.microsoft.com/en-us/sql/t-sql/statements/print-transact-sql>
47454745 Print ( PrintStatement ) ,
4746+ /// MSSQL `WAITFOR` statement.
4747+ ///
4748+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
4749+ WaitFor ( WaitForStatement ) ,
47464750 /// ```sql
47474751 /// RETURN [ expression ]
47484752 /// ```
@@ -6196,6 +6200,7 @@ impl fmt::Display for Statement {
61966200 }
61976201 Statement :: Throw ( s) => write ! ( f, "{s}" ) ,
61986202 Statement :: Print ( s) => write ! ( f, "{s}" ) ,
6203+ Statement :: WaitFor ( s) => write ! ( f, "{s}" ) ,
61996204 Statement :: Return ( r) => write ! ( f, "{r}" ) ,
62006205 Statement :: List ( command) => write ! ( f, "LIST {command}" ) ,
62016206 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
@@ -10939,6 +10944,47 @@ impl fmt::Display for PrintStatement {
1093910944 }
1094010945}
1094110946
10947+ /// The type of `WAITFOR` statement (MSSQL).
10948+ ///
10949+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
10950+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10951+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10952+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10953+ pub enum WaitForType {
10954+ /// `WAITFOR DELAY 'time_to_pass'`
10955+ Delay ,
10956+ /// `WAITFOR TIME 'time_to_execute'`
10957+ Time ,
10958+ }
10959+
10960+ impl fmt:: Display for WaitForType {
10961+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10962+ match self {
10963+ WaitForType :: Delay => write ! ( f, "DELAY" ) ,
10964+ WaitForType :: Time => write ! ( f, "TIME" ) ,
10965+ }
10966+ }
10967+ }
10968+
10969+ /// MSSQL `WAITFOR` statement.
10970+ ///
10971+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
10972+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10973+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10974+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10975+ pub struct WaitForStatement {
10976+ /// `DELAY` or `TIME`.
10977+ pub wait_type : WaitForType ,
10978+ /// The time expression.
10979+ pub expr : Expr ,
10980+ }
10981+
10982+ impl fmt:: Display for WaitForStatement {
10983+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10984+ write ! ( f, "WAITFOR {} {}" , self . wait_type, self . expr)
10985+ }
10986+ }
10987+
1094210988/// Represents a `Return` statement.
1094310989///
1094410990/// [MsSql triggers](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql)
0 commit comments