diff --git a/examples/parse_select.rs b/examples/parse_select.rs index fb22caac..c1419c33 100644 --- a/examples/parse_select.rs +++ b/examples/parse_select.rs @@ -3,13 +3,12 @@ extern crate sqlparser; use sqlparser::sqlparser::*; fn main() { - let sql = "SELECT a, b, 123, myfunc(b) \ - FROM table_1 \ - WHERE a > b AND b < 100 \ - ORDER BY a DESC, b"; + FROM table_1 \ + WHERE a > b AND b < 100 \ + ORDER BY a DESC, b"; let ast = Parser::parse_sql(sql.to_string()).unwrap(); println!("AST: {:?}", ast); -} \ No newline at end of file +} diff --git a/src/sqlast.rs b/src/sqlast.rs index 396a8529..afc02e8e 100644 --- a/src/sqlast.rs +++ b/src/sqlast.rs @@ -117,7 +117,6 @@ pub enum SQLType { Time, /// Timestamp Timestamp, - } /// SQL Operator diff --git a/src/sqlparser.rs b/src/sqlparser.rs index 573a78f0..7ba82ea8 100644 --- a/src/sqlparser.rs +++ b/src/sqlparser.rs @@ -309,7 +309,6 @@ impl Parser { true } - //TODO: this function is inconsistent and sometimes returns bool and sometimes fails /// Consume the next token if it matches the expected token, otherwise return an error @@ -383,10 +382,7 @@ impl Parser { } } - Ok(ASTNode::SQLCreateTable { - name: id, - columns, - }) + Ok(ASTNode::SQLCreateTable { name: id, columns }) } _ => parser_err!(format!( "Unexpected token after CREATE EXTERNAL TABLE: {:?}", @@ -802,10 +798,7 @@ mod tests { ); let ast = parse_sql(&sql); match ast { - ASTNode::SQLCreateTable { - name, - columns, - } => { + ASTNode::SQLCreateTable { name, columns } => { assert_eq!("uk_cities", name); assert_eq!(3, columns.len()); diff --git a/src/sqltokenizer.rs b/src/sqltokenizer.rs index 7b4f38e7..912f8442 100644 --- a/src/sqltokenizer.rs +++ b/src/sqltokenizer.rs @@ -166,8 +166,7 @@ impl Tokenizer { .filter(|t| match t { Token::Whitespace => false, _ => true, - }) - .collect()) + }).collect()) } /// Get the next token or return None