Add support for PRINT statement for SQL Server (#1811)

This commit is contained in:
Andrew Harper 2025-04-18 02:59:39 -04:00 committed by GitHub
parent 81d8909e00
commit 4a487290ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 1 deletions

View file

@ -617,6 +617,7 @@ impl<'a> Parser<'a> {
}
// `COMMENT` is snowflake specific https://docs.snowflake.com/en/sql-reference/sql/comment
Keyword::COMMENT if self.dialect.supports_comment_on() => self.parse_comment(),
Keyword::PRINT => self.parse_print(),
_ => self.expected("an SQL statement", next_token),
},
Token::LParen => {
@ -15056,6 +15057,13 @@ impl<'a> Parser<'a> {
}
}
/// Parse [Statement::Print]
fn parse_print(&mut self) -> Result<Statement, ParserError> {
Ok(Statement::Print(PrintStatement {
message: Box::new(self.parse_expr()?),
}))
}
/// Consume the parser and return its underlying token buffer
pub fn into_tokens(self) -> Vec<TokenWithSpan> {
self.tokens