mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-25 00:14:06 +00:00
Change the default serialization of "not equals" operator to <>
`!=` is not standard, though widely supported - https://stackoverflow.com/a/723426/1026
This commit is contained in:
parent
f93e69d1d4
commit
eeae3af6a3
3 changed files with 5 additions and 5 deletions
|
@ -32,7 +32,7 @@ impl ToString for SQLOperator {
|
|||
SQLOperator::GtEq => ">=".to_string(),
|
||||
SQLOperator::LtEq => "<=".to_string(),
|
||||
SQLOperator::Eq => "=".to_string(),
|
||||
SQLOperator::NotEq => "!=".to_string(),
|
||||
SQLOperator::NotEq => "<>".to_string(),
|
||||
SQLOperator::And => "AND".to_string(),
|
||||
SQLOperator::Or => "OR".to_string(),
|
||||
SQLOperator::Not => "NOT".to_string(),
|
||||
|
|
|
@ -43,7 +43,7 @@ pub enum Token {
|
|||
Whitespace(Whitespace),
|
||||
/// Equality operator `=`
|
||||
Eq,
|
||||
/// Not Equals operator `!=` or `<>`
|
||||
/// Not Equals operator `<>` (or `!=` in some dialects)
|
||||
Neq,
|
||||
/// Less Than operator `<`
|
||||
Lt,
|
||||
|
@ -100,7 +100,7 @@ impl ToString for Token {
|
|||
Token::Comma => ",".to_string(),
|
||||
Token::Whitespace(ws) => ws.to_string(),
|
||||
Token::Eq => "=".to_string(),
|
||||
Token::Neq => "-".to_string(),
|
||||
Token::Neq => "<>".to_string(),
|
||||
Token::Lt => "<".to_string(),
|
||||
Token::Gt => ">".to_string(),
|
||||
Token::LtEq => "<=".to_string(),
|
||||
|
|
|
@ -221,7 +221,7 @@ fn parse_collate() {
|
|||
#[test]
|
||||
fn parse_select_string_predicate() {
|
||||
let sql = "SELECT id, fname, lname FROM customer \
|
||||
WHERE salary != 'Not Provided' AND salary != ''";
|
||||
WHERE salary <> 'Not Provided' AND salary <> ''";
|
||||
let _ast = verified_only_select(sql);
|
||||
//TODO: add assertions
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ fn parse_escaped_single_quote_string_predicate() {
|
|||
use self::ASTNode::*;
|
||||
use self::SQLOperator::*;
|
||||
let sql = "SELECT id, fname, lname FROM customer \
|
||||
WHERE salary != 'Jim''s salary'";
|
||||
WHERE salary <> 'Jim''s salary'";
|
||||
let ast = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
Some(SQLBinaryExpr {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue