@@ -157,7 +157,7 @@ fn parse_delete_statement() {
157
157
#[ test]
158
158
fn parse_where_delete_statement ( ) {
159
159
use self :: ASTNode :: * ;
160
- use self :: SQLOperator :: * ;
160
+ use self :: SQLBinaryOperator :: * ;
161
161
162
162
let sql = "DELETE FROM foo WHERE name = 5" ;
163
163
match verified_stmt ( sql) {
@@ -276,7 +276,7 @@ fn parse_column_aliases() {
276
276
ref alias,
277
277
} = only ( & select. projection )
278
278
{
279
- assert_eq ! ( & SQLOperator :: Plus , op) ;
279
+ assert_eq ! ( & SQLBinaryOperator :: Plus , op) ;
280
280
assert_eq ! ( & ASTNode :: SQLValue ( Value :: Long ( 1 ) ) , right. as_ref( ) ) ;
281
281
assert_eq ! ( "newname" , alias) ;
282
282
} else {
@@ -325,7 +325,7 @@ fn parse_select_count_distinct() {
325
325
& ASTNode :: SQLFunction ( SQLFunction {
326
326
name: SQLObjectName ( vec![ "COUNT" . to_string( ) ] ) ,
327
327
args: vec![ ASTNode :: SQLUnaryOp {
328
- op: SQLOperator :: Plus ,
328
+ op: SQLUnaryOperator :: Plus ,
329
329
expr: Box :: new( ASTNode :: SQLIdentifier ( "x" . to_string( ) ) )
330
330
} ] ,
331
331
over: None ,
@@ -392,7 +392,7 @@ fn parse_projection_nested_type() {
392
392
#[ test]
393
393
fn parse_escaped_single_quote_string_predicate ( ) {
394
394
use self :: ASTNode :: * ;
395
- use self :: SQLOperator :: * ;
395
+ use self :: SQLBinaryOperator :: * ;
396
396
let sql = "SELECT id, fname, lname FROM customer \
397
397
WHERE salary <> 'Jim''s salary'";
398
398
let ast = verified_only_select ( sql) ;
@@ -411,7 +411,7 @@ fn parse_escaped_single_quote_string_predicate() {
411
411
#[ test]
412
412
fn parse_compound_expr_1 ( ) {
413
413
use self :: ASTNode :: * ;
414
- use self :: SQLOperator :: * ;
414
+ use self :: SQLBinaryOperator :: * ;
415
415
let sql = "a + b * c" ;
416
416
assert_eq ! (
417
417
SQLBinaryOp {
@@ -430,7 +430,7 @@ fn parse_compound_expr_1() {
430
430
#[ test]
431
431
fn parse_compound_expr_2 ( ) {
432
432
use self :: ASTNode :: * ;
433
- use self :: SQLOperator :: * ;
433
+ use self :: SQLBinaryOperator :: * ;
434
434
let sql = "a * b + c" ;
435
435
assert_eq ! (
436
436
SQLBinaryOp {
@@ -449,17 +449,16 @@ fn parse_compound_expr_2() {
449
449
#[ test]
450
450
fn parse_unary_math ( ) {
451
451
use self :: ASTNode :: * ;
452
- use self :: SQLOperator :: * ;
453
452
let sql = "- a + - b" ;
454
453
assert_eq ! (
455
454
SQLBinaryOp {
456
455
left: Box :: new( SQLUnaryOp {
457
- op: Minus ,
456
+ op: SQLUnaryOperator :: Minus ,
458
457
expr: Box :: new( SQLIdentifier ( "a" . to_string( ) ) ) ,
459
458
} ) ,
460
- op: Plus ,
459
+ op: SQLBinaryOperator :: Plus ,
461
460
right: Box :: new( SQLUnaryOp {
462
- op: Minus ,
461
+ op: SQLUnaryOperator :: Minus ,
463
462
expr: Box :: new( SQLIdentifier ( "b" . to_string( ) ) ) ,
464
463
} ) ,
465
464
} ,
@@ -493,14 +492,14 @@ fn parse_not_precedence() {
493
492
// NOT has higher precedence than OR/AND, so the following must parse as (NOT true) OR true
494
493
let sql = "NOT true OR true" ;
495
494
assert_matches ! ( verified_expr( sql) , SQLBinaryOp {
496
- op: SQLOperator :: Or ,
495
+ op: SQLBinaryOperator :: Or ,
497
496
..
498
497
} ) ;
499
498
500
499
// But NOT has lower precedence than comparison operators, so the following parses as NOT (a IS NULL)
501
500
let sql = "NOT a IS NULL" ;
502
501
assert_matches ! ( verified_expr( sql) , SQLUnaryOp {
503
- op: SQLOperator :: Not ,
502
+ op: SQLUnaryOperator :: Not ,
504
503
..
505
504
} ) ;
506
505
@@ -509,7 +508,7 @@ fn parse_not_precedence() {
509
508
assert_eq ! (
510
509
verified_expr( sql) ,
511
510
SQLUnaryOp {
512
- op: SQLOperator :: Not ,
511
+ op: SQLUnaryOperator :: Not ,
513
512
expr: Box :: new( SQLBetween {
514
513
expr: Box :: new( SQLValue ( Value :: Long ( 1 ) ) ) ,
515
514
low: Box :: new( SQLValue ( Value :: Long ( 1 ) ) ) ,
@@ -524,10 +523,10 @@ fn parse_not_precedence() {
524
523
assert_eq ! (
525
524
verified_expr( sql) ,
526
525
SQLUnaryOp {
527
- op: SQLOperator :: Not ,
526
+ op: SQLUnaryOperator :: Not ,
528
527
expr: Box :: new( SQLBinaryOp {
529
528
left: Box :: new( SQLValue ( Value :: SingleQuotedString ( "a" . into( ) ) ) ) ,
530
- op: SQLOperator :: NotLike ,
529
+ op: SQLBinaryOperator :: NotLike ,
531
530
right: Box :: new( SQLValue ( Value :: SingleQuotedString ( "b" . into( ) ) ) ) ,
532
531
} ) ,
533
532
} ,
@@ -538,7 +537,7 @@ fn parse_not_precedence() {
538
537
assert_eq ! (
539
538
verified_expr( sql) ,
540
539
SQLUnaryOp {
541
- op: SQLOperator :: Not ,
540
+ op: SQLUnaryOperator :: Not ,
542
541
expr: Box :: new( SQLInList {
543
542
expr: Box :: new( SQLIdentifier ( "a" . into( ) ) ) ,
544
543
list: vec![ SQLValue ( Value :: SingleQuotedString ( "a" . into( ) ) ) ] ,
@@ -560,9 +559,9 @@ fn parse_like() {
560
559
ASTNode :: SQLBinaryOp {
561
560
left: Box :: new( ASTNode :: SQLIdentifier ( "name" . to_string( ) ) ) ,
562
561
op: if negated {
563
- SQLOperator :: NotLike
562
+ SQLBinaryOperator :: NotLike
564
563
} else {
565
- SQLOperator :: Like
564
+ SQLBinaryOperator :: Like
566
565
} ,
567
566
right: Box :: new( ASTNode :: SQLValue ( Value :: SingleQuotedString (
568
567
"%a" . to_string( )
@@ -582,9 +581,9 @@ fn parse_like() {
582
581
ASTNode :: SQLIsNull ( Box :: new( ASTNode :: SQLBinaryOp {
583
582
left: Box :: new( ASTNode :: SQLIdentifier ( "name" . to_string( ) ) ) ,
584
583
op: if negated {
585
- SQLOperator :: NotLike
584
+ SQLBinaryOperator :: NotLike
586
585
} else {
587
- SQLOperator :: Like
586
+ SQLBinaryOperator :: Like
588
587
} ,
589
588
right: Box :: new( ASTNode :: SQLValue ( Value :: SingleQuotedString (
590
589
"%a" . to_string( )
@@ -660,7 +659,7 @@ fn parse_between() {
660
659
#[ test]
661
660
fn parse_between_with_expr ( ) {
662
661
use self :: ASTNode :: * ;
663
- use self :: SQLOperator :: * ;
662
+ use self :: SQLBinaryOperator :: * ;
664
663
let sql = "SELECT * FROM t WHERE 1 BETWEEN 1 + 2 AND 3 + 4 IS NULL" ;
665
664
let select = verified_only_select ( sql) ;
666
665
assert_eq ! (
@@ -687,14 +686,14 @@ fn parse_between_with_expr() {
687
686
ASTNode :: SQLBinaryOp {
688
687
left: Box :: new( ASTNode :: SQLBinaryOp {
689
688
left: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
690
- op: SQLOperator :: Eq ,
689
+ op: SQLBinaryOperator :: Eq ,
691
690
right: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
692
691
} ) ,
693
- op: SQLOperator :: And ,
692
+ op: SQLBinaryOperator :: And ,
694
693
right: Box :: new( ASTNode :: SQLBetween {
695
694
expr: Box :: new( ASTNode :: SQLBinaryOp {
696
695
left: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
697
- op: SQLOperator :: Plus ,
696
+ op: SQLBinaryOperator :: Plus ,
698
697
right: Box :: new( ASTNode :: SQLIdentifier ( "x" . to_string( ) ) ) ,
699
698
} ) ,
700
699
low: Box :: new( ASTNode :: SQLValue ( Value :: Long ( 1 ) ) ) ,
@@ -1353,7 +1352,7 @@ fn parse_delimited_identifiers() {
1353
1352
#[ test]
1354
1353
fn parse_parens ( ) {
1355
1354
use self :: ASTNode :: * ;
1356
- use self :: SQLOperator :: * ;
1355
+ use self :: SQLBinaryOperator :: * ;
1357
1356
let sql = "(a + b) - (c + d)" ;
1358
1357
assert_eq ! (
1359
1358
SQLBinaryOp {
@@ -1377,7 +1376,7 @@ fn parse_parens() {
1377
1376
fn parse_searched_case_expression ( ) {
1378
1377
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" ;
1379
1378
use self :: ASTNode :: { SQLBinaryOp , SQLCase , SQLIdentifier , SQLIsNull , SQLValue } ;
1380
- use self :: SQLOperator :: * ;
1379
+ use self :: SQLBinaryOperator :: * ;
1381
1380
let select = verified_only_select ( sql) ;
1382
1381
assert_eq ! (
1383
1382
& SQLCase {
@@ -1545,7 +1544,7 @@ fn parse_joins_on() {
1545
1544
} ,
1546
1545
join_operator : f ( JoinConstraint :: On ( ASTNode :: SQLBinaryOp {
1547
1546
left : Box :: new ( ASTNode :: SQLIdentifier ( "c1" . into ( ) ) ) ,
1548
- op : SQLOperator :: Eq ,
1547
+ op : SQLBinaryOperator :: Eq ,
1549
1548
right : Box :: new ( ASTNode :: SQLIdentifier ( "c2" . into ( ) ) ) ,
1550
1549
} ) ) ,
1551
1550
}
@@ -1909,7 +1908,7 @@ fn parse_scalar_subqueries() {
1909
1908
use self :: ASTNode :: * ;
1910
1909
let sql = "(SELECT 1) + (SELECT 2)" ;
1911
1910
assert_matches ! ( verified_expr( sql) , SQLBinaryOp {
1912
- op: SQLOperator :: Plus , ..
1911
+ op: SQLBinaryOperator :: Plus , ..
1913
1912
//left: box SQLSubquery { .. },
1914
1913
//right: box SQLSubquery { .. },
1915
1914
} ) ;
@@ -1929,7 +1928,7 @@ fn parse_exists_subquery() {
1929
1928
let select = verified_only_select ( sql) ;
1930
1929
assert_eq ! (
1931
1930
ASTNode :: SQLUnaryOp {
1932
- op: SQLOperator :: Not ,
1931
+ op: SQLUnaryOperator :: Not ,
1933
1932
expr: Box :: new( ASTNode :: SQLExists ( Box :: new( expected_inner) ) ) ,
1934
1933
} ,
1935
1934
select. selection. unwrap( ) ,
0 commit comments