mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-24 16:04:04 +00:00
Update code sample in README
This commit is contained in:
parent
e16b92763a
commit
48e78f99dd
1 changed files with 6 additions and 4 deletions
10
README.md
10
README.md
|
@ -16,11 +16,13 @@ The current code is capable of parsing some trivial SELECT and CREATE TABLE stat
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let sql = "SELECT a, b, 123, myfunc(b) \
|
let sql = "SELECT a, b, 123, myfunc(b) \
|
||||||
FROM table_1 \
|
FROM table_1 \
|
||||||
WHERE a > b AND b < 100 \
|
WHERE a > b AND b < 100 \
|
||||||
ORDER BY a DESC, b";
|
ORDER BY a DESC, b";
|
||||||
|
|
||||||
let ast = Parser::parse_sql(sql.to_string()).unwrap();
|
let dialect = GenericSqlDialect{}; // or AnsiSqlDialect, or your own dialect ...
|
||||||
|
|
||||||
|
let ast = Parser::parse_sql(&dialect,sql.to_string()).unwrap();
|
||||||
|
|
||||||
println!("AST: {:?}", ast);
|
println!("AST: {:?}", ast);
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue