mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-04 05:00:34 +00:00
Support national string literals (N'...')
Widely used in MS SQL and specified in ANSI.
This commit is contained in:
parent
b9f4b503b6
commit
35dd9342e2
4 changed files with 76 additions and 33 deletions
|
@ -191,7 +191,9 @@ impl Parser {
|
|||
},
|
||||
},
|
||||
Token::Mult => Ok(ASTNode::SQLWildcard),
|
||||
Token::Number(_) | Token::SingleQuotedString(_) => {
|
||||
Token::Number(_)
|
||||
| Token::SingleQuotedString(_)
|
||||
| Token::NationalStringLiteral(_) => {
|
||||
self.prev_token();
|
||||
self.parse_sql_value()
|
||||
}
|
||||
|
@ -205,7 +207,7 @@ impl Parser {
|
|||
Ok(expr)
|
||||
}
|
||||
_ => parser_err!(format!(
|
||||
"Prefix parser expected a keyword but found {:?}",
|
||||
"Did not expect {:?} at the beginning of an expression",
|
||||
t
|
||||
)),
|
||||
},
|
||||
|
@ -790,7 +792,10 @@ impl Parser {
|
|||
Token::SingleQuotedString(ref s) => {
|
||||
Ok(Value::SingleQuotedString(s.to_string()))
|
||||
}
|
||||
_ => parser_err!(format!("Unsupported value: {:?}", self.peek_token())),
|
||||
Token::NationalStringLiteral(ref s) => {
|
||||
Ok(Value::NationalStringLiteral(s.to_string()))
|
||||
}
|
||||
_ => parser_err!(format!("Unsupported value: {:?}", t)),
|
||||
}
|
||||
}
|
||||
None => parser_err!("Expecting a value, but found EOF"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue