@@ -169,7 +169,7 @@ fn parse_delete_statement() {
169
169
#[ test]
170
170
fn parse_where_delete_statement ( ) {
171
171
use self :: ASTNode :: * ;
172
- use self :: SQLOperator :: * ;
172
+ use self :: SQLBinaryOperator :: * ;
173
173
174
174
let sql = "DELETE FROM foo WHERE name = 5" ;
175
175
match verified_stmt ( sql) {
@@ -288,7 +288,7 @@ fn parse_column_aliases() {
288
288
ref alias,
289
289
} = only ( & select. projection )
290
290
{
291
- assert_eq ! ( & SQLOperator :: Plus , op) ;
291
+ assert_eq ! ( & SQLBinaryOperator :: Plus , op) ;
292
292
assert_eq ! ( & ASTNode :: SQLValue ( Value :: Long ( 1 ) ) , right. as_ref( ) ) ;
293
293
assert_eq ! ( "newname" , alias) ;
294
294
} else {
@@ -337,7 +337,7 @@ fn parse_select_count_distinct() {
337
337
& ASTNode :: SQLFunction ( SQLFunction {
338
338
name: SQLObjectName ( vec![ "COUNT" . to_string( ) ] ) ,
339
339
args: vec![ ASTNode :: SQLUnaryOp {
340
- op: SQLOperator :: Plus ,
340
+ op: SQLUnaryOperator :: Plus ,
341
341
expr: Box :: new( ASTNode :: SQLIdentifier ( "x" . to_string( ) ) )
342
342
} ] ,
343
343
over: None ,
@@ -404,7 +404,7 @@ fn parse_projection_nested_type() {
404
404
#[ test]
405
405
fn parse_escaped_single_quote_string_predicate ( ) {
406
406
use self :: ASTNode :: * ;
407
- use self :: SQLOperator :: * ;
407
+ use self :: SQLBinaryOperator :: * ;
408
408
let sql = "SELECT id, fname, lname FROM customer \
409
409
WHERE salary <> 'Jim''s salary'";
410
410
let ast = verified_only_select ( sql) ;
@@ -423,7 +423,7 @@ fn parse_escaped_single_quote_string_predicate() {
423
423
#[ test]
424
424
fn parse_compound_expr_1 ( ) {
425
425
use self :: ASTNode :: * ;
426
- use self :: SQLOperator :: * ;
426
+ use self :: SQLBinaryOperator :: * ;
427
427
let sql = "a + b * c" ;
428
428
assert_eq ! (
429
429
SQLBinaryOp {
@@ -442,7 +442,7 @@ fn parse_compound_expr_1() {
442
442
#[ test]
443
443
fn parse_compound_expr_2 ( ) {
444
444
use self :: ASTNode :: * ;
445
- use self :: SQLOperator :: * ;
445
+ use self :: SQLBinaryOperator :: * ;
446
446
let sql = "a * b + c" ;
447
447
assert_eq ! (
448
448
SQLBinaryOp {
@@ -461,17 +461,16 @@ fn parse_compound_expr_2() {
461
461
#[ test]
462
462
fn parse_unary_math ( ) {
463
463
use self :: ASTNode :: * ;
464
- use self :: SQLOperator :: * ;
465
464
let sql = "- a + - b" ;
466
465
assert_eq ! (
467
466
SQLBinaryOp {
468
467
left: Box :: new( SQLUnaryOp {
469
- op: Minus ,
468
+ op: SQLUnaryOperator :: Minus ,
470
469
expr: Box :: new( SQLIdentifier ( "a" . to_string( ) ) ) ,
471
470
} ) ,
472
- op: Plus ,
471
+ op: SQLBinaryOperator :: Plus ,
473
472
right: Box :: new( SQLUnaryOp {
474
- op: Minus ,
473
+ op: SQLUnaryOperator :: Minus ,
475
474
expr: Box :: new( SQLIdentifier ( "b" . to_string( ) ) ) ,
476
475
} ) ,
477
476
} ,
@@ -505,14 +504,14 @@ fn parse_not_precedence() {
505
504
// NOT has higher precedence than OR/AND, so the following must parse as (NOT true) OR true
506
505
let sql = "NOT true OR true" ;
507
506
assert_matches ! ( verified_expr( sql) , SQLBinaryOp {
508
- op: SQLOperator :: Or ,
507
+ op: SQLBinaryOperator :: Or ,
509
508
..
510
509
} ) ;
511
510
512
511
// But NOT has lower precedence than comparison operators, so the following parses as NOT (a IS NULL)
513
512
let sql = "NOT a IS NULL" ;
514
513
assert_matches ! ( verified_expr( sql) , SQLUnaryOp {
515
- op: SQLOperator :: Not ,
514
+ op: SQLUnaryOperator :: Not ,
516
515
..
517
516
} ) ;
518
517
@@ -521,7 +520,7 @@ fn parse_not_precedence() {
521
520
assert_eq ! (
522
521
verified_expr( sql) ,
523
522
SQLUnaryOp {
524
- op: SQLOperator :: Not ,
523
+ op: SQLUnaryOperator :: Not ,
525
524
expr: Box :: new( SQLBetween {
526
525
expr: Box :: new( SQLValue ( Value :: Long ( 1 ) ) ) ,
527
526
low: Box :: new( SQLValue ( Value :: Long ( 1 ) ) ) ,
@@ -536,10 +535,10 @@ fn parse_not_precedence() {
536
535
assert_eq ! (
537
536
verified_expr( sql) ,
538
537
SQLUnaryOp {
539
- op: SQLOperator :: Not ,
538
+ op: SQLUnaryOperator :: Not ,
540
539
expr: Box :: new( SQLBinaryOp {
541
540
left: Box :: new( SQLValue ( Value :: SingleQuotedString ( "a" . into( ) ) ) ) ,
542
- op: SQLOperator :: NotLike ,
541
+ op: SQLBinaryOperator :: NotLike ,
543
542
right: Box :: new( SQLValue ( Value :: SingleQuotedString ( "b" . into( ) ) ) ) ,
544
543
} ) ,
545
544
} ,
@@ -550,7 +549,7 @@ fn parse_not_precedence() {
550
549
assert_eq ! (
551
550
verified_expr( sql) ,
552
551
SQLUnaryOp {
553
- op: SQLOperator :: Not ,
552
+ op: SQLUnaryOperator :: Not ,
554
553
expr: Box :: new( SQLInList {
555
554
expr: Box :: new( SQLIdentifier ( "a" . into( ) ) ) ,
556
555
list: vec![ SQLValue ( Value :: SingleQuotedString ( "a" . into( ) ) ) ] ,
@@ -572,9 +571,9 @@ fn parse_like() {
572
571
ASTNode :: SQLBinaryOp {
573
572
left: Box :: new( ASTNode :: SQLIdentifier ( "name" . to_string( ) ) ) ,
574
573
op: if negated {
575
- SQLOperator :: NotLike
574
+ SQLBinaryOperator :: NotLike
576
575
} else {
577
- SQLOperator :: Like
576
+ SQLBinaryOperator :: Like
578
577
} ,
579
578
right: Box :: new( ASTNode :: SQLValue ( Value :: SingleQuotedString (
580
579
"%a" . to_string( )
@@ -594,9 +593,9 @@ fn parse_like() {
594
593
ASTNode :: SQLIsNull ( Box :: new( ASTNode :: SQLBinaryOp {
595
594
left: Box :: new( ASTNode :: SQLIdentifier ( "name" . to_string( ) ) ) ,
596
595
op: if negated {
597
- SQLOperator :: NotLike
596
+ SQLBinaryOperator :: NotLike
598
597
} else {
599
- SQLOperator :: Like
598
+ SQLBinaryOperator :: Like
600
599
} ,
601
600
right: Box :: new( ASTNode :: SQLValue ( Value :: SingleQuotedString (
602
601
"%a" . to_string( )
@@ -672,7 +671,7 @@ fn parse_between() {
672
671
#[ test]
673
672
fn parse_between_with_expr ( ) {
674
673
use self :: ASTNode :: * ;
675
- use self :: SQLOperator :: * ;
674
+ use self :: SQLBinaryOperator :: * ;
676
675
let sql = "SELECT * FROM t WHERE 1 BETWEEN 1 + 2 AND 3 + 4 IS NULL" ;
677
676
let select = verified_only_select ( sql) ;
678
677
assert_eq ! (
@@ -699,14 +698,14 @@ fn parse_between_with_expr() {
699
698
ASTNode :: SQLBinaryOp {
700
699
left: Box :: new( ASTNode :: SQLBinaryOp {
701
700
left: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
702
- op: SQLOperator :: Eq ,
701
+ op: SQLBinaryOperator :: Eq ,
703
702
right: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
704
703
} ) ,
705
- op: SQLOperator :: And ,
704
+ op: SQLBinaryOperator :: And ,
706
705
right: Box :: new( ASTNode :: SQLBetween {
707
706
expr: Box :: new( ASTNode :: SQLBinaryOp {
708
707
left: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
709
- op: SQLOperator :: Plus ,
708
+ op: SQLBinaryOperator :: Plus ,
710
709
right: Box :: new( ASTNode :: SQLIdentifier ( "x" . to_string( ) ) ) ,
711
710
} ) ,
712
711
low: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
@@ -1365,7 +1364,7 @@ fn parse_delimited_identifiers() {
1365
1364
#[ test]
1366
1365
fn parse_parens ( ) {
1367
1366
use self :: ASTNode :: * ;
1368
- use self :: SQLOperator :: * ;
1367
+ use self :: SQLBinaryOperator :: * ;
1369
1368
let sql = "(a + b) - (c + d)" ;
1370
1369
assert_eq ! (
1371
1370
SQLBinaryOp {
@@ -1389,7 +1388,7 @@ fn parse_parens() {
1389
1388
fn parse_searched_case_expression ( ) {
1390
1389
let sql = "SELECT CASE WHEN bar IS NULL THEN 'null' WHEN bar = 0 THEN '=0' WHEN bar >= 0 THEN '>=0' ELSE '<0' END FROM foo" ;
1391
1390
use self :: ASTNode :: { SQLBinaryOp , SQLCase , SQLIdentifier , SQLIsNull , SQLValue } ;
1392
- use self :: SQLOperator :: * ;
1391
+ use self :: SQLBinaryOperator :: * ;
1393
1392
let select = verified_only_select ( sql) ;
1394
1393
assert_eq ! (
1395
1394
& SQLCase {
@@ -1557,7 +1556,7 @@ fn parse_joins_on() {
1557
1556
} ,
1558
1557
join_operator : f ( JoinConstraint :: On ( ASTNode :: SQLBinaryOp {
1559
1558
left : Box :: new ( ASTNode :: SQLIdentifier ( "c1" . into ( ) ) ) ,
1560
- op : SQLOperator :: Eq ,
1559
+ op : SQLBinaryOperator :: Eq ,
1561
1560
right : Box :: new ( ASTNode :: SQLIdentifier ( "c2" . into ( ) ) ) ,
1562
1561
} ) ) ,
1563
1562
}
@@ -1921,7 +1920,7 @@ fn parse_scalar_subqueries() {
1921
1920
use self :: ASTNode :: * ;
1922
1921
let sql = "(SELECT 1) + (SELECT 2)" ;
1923
1922
assert_matches ! ( verified_expr( sql) , SQLBinaryOp {
1924
- op: SQLOperator :: Plus , ..
1923
+ op: SQLBinaryOperator :: Plus , ..
1925
1924
//left: box SQLSubquery { .. },
1926
1925
//right: box SQLSubquery { .. },
1927
1926
} ) ;
@@ -1941,7 +1940,7 @@ fn parse_exists_subquery() {
1941
1940
let select = verified_only_select ( sql) ;
1942
1941
assert_eq ! (
1943
1942
ASTNode :: SQLUnaryOp {
1944
- op: SQLOperator :: Not ,
1943
+ op: SQLUnaryOperator :: Not ,
1945
1944
expr: Box :: new( ASTNode :: SQLExists ( Box :: new( expected_inner) ) ) ,
1946
1945
} ,
1947
1946
select. selection. unwrap( ) ,
0 commit comments