iffyio commented on code in PR #2041:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2041#discussion_r2403803588
##########
tests/sqlparser_mssql.rs:
##########
@@ -198,6 +200,12 @@ fn parse_mssql_create_procedure() {
let _ = ms().verified_stmt("CREATE PROCEDURE [foo] AS BEGIN UPDATE bar SET
col = 'test'; SELECT [foo] FROM BAR WHERE [FOO] > 10; END");
}
+#[test]
+fn parse_mssql_create_procedure_with_parameter_default_value() {
+ let sql = r#"CREATE PROCEDURE foo (IN @a INTEGER = 1, OUT @b TEXT = '2',
INOUT @c DATETIME = NULL, @d BOOL = 0) AS BEGIN SELECT 1; END"#;
+ let _ = ms().verified_stmt(sql);
+}
Review Comment:
Similar comment here that we can inline this scenario into the
`parse_mssql_create_procedure` function above
##########
tests/sqlparser_common.rs:
##########
@@ -16533,6 +16537,74 @@ fn parse_create_procedure_with_parameter_modes() {
}
}
+#[test]
+fn create_procedure_with_parameter_default_value() {
+ let sql = r#"CREATE PROCEDURE test_proc (IN a INTEGER = 1, OUT b TEXT =
'2', INOUT c TIMESTAMP = NULL, d BOOL = 0) AS BEGIN SELECT 1; END"#;
+ match verified_stmt(sql) {
+ Statement::CreateProcedure {
+ or_alter,
+ name,
+ params,
+ ..
+ } => {
+ assert_eq!(or_alter, false);
+ assert_eq!(name.to_string(), "test_proc");
+ let fake_span = Span {
+ start: Location { line: 0, column: 0 },
+ end: Location { line: 0, column: 0 },
+ };
+ assert_eq!(
+ params,
+ Some(vec![
+ ProcedureParam {
+ name: Ident {
+ value: "a".into(),
+ quote_style: None,
+ span: fake_span,
+ },
Review Comment:
```suggestion
name: Ident::new("a"),
```
I think this can be simplified? that would let us skip introducing the fake
span as well
##########
tests/sqlparser_common.rs:
##########
@@ -16533,6 +16537,40 @@ fn parse_create_procedure_with_parameter_modes() {
}
}
+#[test]
+fn create_procedure_with_parameter_default_value() {
Review Comment:
Ah no I meant to only inline this test case into that
`parse_create_procedure_with_parameter_modes` function vs having one function
per test case
--
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]