Skip to content

Commit d30d63d

Browse files
committed
Support the string concat operator
1 parent 9ac9c8d commit d30d63d

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/tokenizer.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,12 @@ impl<'a> Tokenizer<'a> {
380380
'|' => {
381381
chars.next(); // consume the '|'
382382
match chars.peek() {
383-
Some('|') => {
384-
self.consume_and_return(chars, Token::StringConcat)
385-
}
383+
Some('|') => self.consume_and_return(chars, Token::StringConcat),
386384
// a regular '/' operator
387385
_ => Err(TokenizerError(format!(
388386
"Tokenizer Error at Line: {}, Col: {}",
389387
self.line, self.col
390-
)))
388+
))),
391389
}
392390
}
393391
'=' => self.consume_and_return(chars, Token::Eq),

tests/sqlparser_common.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -671,19 +671,15 @@ fn parse_string_agg() {
671671

672672
let select = verified_only_select(sql);
673673
assert_eq!(
674-
SelectItem::UnnamedExpr(
675-
Expr::BinaryOp {
676-
left: Box::new(Expr::Identifier(Ident::new("a"))),
677-
op: BinaryOperator::StringConcat,
678-
right: Box::new(Expr::Identifier(Ident::new("b"))),
679-
}
680-
),
674+
SelectItem::UnnamedExpr(Expr::BinaryOp {
675+
left: Box::new(Expr::Identifier(Ident::new("a"))),
676+
op: BinaryOperator::StringConcat,
677+
right: Box::new(Expr::Identifier(Ident::new("b"))),
678+
}),
681679
select.projection[0]
682680
);
683-
684681
}
685682

686-
687683
#[test]
688684
fn parse_between() {
689685
fn chk(negated: bool) {

0 commit comments

Comments
 (0)