mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-03 22:08:16 +00:00
Merge pull request #95 from benesch/hex-literals
Support hexadecimal string literals
This commit is contained in:
commit
b12fb34f3d
4 changed files with 36 additions and 3 deletions
|
@ -952,9 +952,9 @@ fn parse_aggregate_with_group_by() {
|
|||
|
||||
#[test]
|
||||
fn parse_literal_string() {
|
||||
let sql = "SELECT 'one', N'national string'";
|
||||
let sql = "SELECT 'one', N'national string', X'deadBEEF'";
|
||||
let select = verified_only_select(sql);
|
||||
assert_eq!(2, select.projection.len());
|
||||
assert_eq!(3, select.projection.len());
|
||||
assert_eq!(
|
||||
&ASTNode::SQLValue(Value::SingleQuotedString("one".to_string())),
|
||||
expr_from_projection(&select.projection[0])
|
||||
|
@ -963,6 +963,12 @@ fn parse_literal_string() {
|
|||
&ASTNode::SQLValue(Value::NationalStringLiteral("national string".to_string())),
|
||||
expr_from_projection(&select.projection[1])
|
||||
);
|
||||
assert_eq!(
|
||||
&ASTNode::SQLValue(Value::HexStringLiteral("deadBEEF".to_string())),
|
||||
expr_from_projection(&select.projection[2])
|
||||
);
|
||||
|
||||
one_statement_parses_to("SELECT x'deadBEEF'", "SELECT X'deadBEEF'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue