iffyio commented on code in PR #2210:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2210#discussion_r2821252792
##########
tests/sqlparser_mssql.rs:
##########
@@ -1702,6 +1702,43 @@ fn test_parse_throw() {
);
}
+#[test]
+fn test_parse_waitfor() {
+ // WAITFOR DELAY
+ let sql = "WAITFOR DELAY '00:00:05'";
+ let stmt = ms_and_generic().verified_stmt(sql);
+ assert_eq!(
+ stmt,
+ Statement::WaitFor(WaitForStatement {
+ wait_type: WaitForType::Delay,
+ expr: Expr::Value(
+
(Value::SingleQuotedString("00:00:05".to_string())).with_empty_span()
+ ),
+ })
+ );
+
+ // WAITFOR TIME
+ let sql = "WAITFOR TIME '14:30:00'";
+ let stmt = ms_and_generic().verified_stmt(sql);
+ assert_eq!(
+ stmt,
+ Statement::WaitFor(WaitForStatement {
+ wait_type: WaitForType::Time,
+ expr: Expr::Value(
+
(Value::SingleQuotedString("14:30:00".to_string())).with_empty_span()
+ ),
+ })
+ );
+
+ // WAITFOR DELAY with variable
+ let sql = "WAITFOR DELAY @WaitTime";
+ let _ = ms().verified_stmt(sql);
Review Comment:
```suggestion
let _ = ms_and_generic().verified_stmt(sql);
```
these as well can cover generic?
##########
tests/sqlparser_mssql.rs:
##########
@@ -1702,6 +1702,43 @@ fn test_parse_throw() {
);
}
+#[test]
+fn test_parse_waitfor() {
+ // WAITFOR DELAY
+ let sql = "WAITFOR DELAY '00:00:05'";
+ let stmt = ms_and_generic().verified_stmt(sql);
+ assert_eq!(
+ stmt,
+ Statement::WaitFor(WaitForStatement {
+ wait_type: WaitForType::Delay,
+ expr: Expr::Value(
+
(Value::SingleQuotedString("00:00:05".to_string())).with_empty_span()
+ ),
+ })
+ );
+
+ // WAITFOR TIME
+ let sql = "WAITFOR TIME '14:30:00'";
+ let stmt = ms_and_generic().verified_stmt(sql);
+ assert_eq!(
+ stmt,
+ Statement::WaitFor(WaitForStatement {
+ wait_type: WaitForType::Time,
+ expr: Expr::Value(
+
(Value::SingleQuotedString("14:30:00".to_string())).with_empty_span()
+ ),
+ })
+ );
+
+ // WAITFOR DELAY with variable
+ let sql = "WAITFOR DELAY @WaitTime";
+ let _ = ms().verified_stmt(sql);
+
+ // Error: WAITFOR without DELAY or TIME
+ let res = ms().parse_sql_statements("WAITFOR '00:00:05'");
Review Comment:
```suggestion
let res = ms_and_generic().parse_sql_statements("WAITFOR '00:00:05'");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]