aharpervc commented on code in PR #1811: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1811#discussion_r2047549413
########## tests/sqlparser_mssql.rs: ########## @@ -2053,3 +2053,37 @@ fn parse_drop_trigger() { } ); } + +#[test] +fn parse_print() { + let print_string_literal = "PRINT 'Hello, world!'"; + let print_stmt = ms().one_statement_parses_to(print_string_literal, ""); + assert_eq!( + print_stmt, + Statement::Print(PrintStatement { + message: Box::new(Expr::Value( + (Value::SingleQuotedString("Hello, world!".to_string())).with_empty_span() + )), + }) + ); + + let print_national_string = "PRINT N'Hello, ⛄️!'"; + let print_stmt = ms().one_statement_parses_to(print_national_string, ""); + assert_eq!( + print_stmt, + Statement::Print(PrintStatement { + message: Box::new(Expr::Value( + (Value::NationalStringLiteral("Hello, ⛄️!".to_string())).with_empty_span() + )), + }) + ); + + let print_variable = "PRINT @my_variable"; + let print_stmt = ms().one_statement_parses_to(print_variable, ""); + assert_eq!( + print_stmt, + Statement::Print(PrintStatement { + message: Box::new(Expr::Identifier(Ident::new("@my_variable"))), + }) + ); Review Comment: I think we might want to inspect the ast in the future if we do an enum of value params instead of an expr, but we can cross that bridge if/when we ever come to it. This suggestion is complete 👍 -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org