apache / apache/datafusion-sqlparser-rs

Parameterized queries

未关闭
#291 11 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
17

描述

This fails to parse, but it can be successfully executed by SQLite (after providing a value for the parameter):

```
#[test]
fn go() {
use sqlparser::dialect::SQLiteDialect;
use sqlparser::parser::Parser;

let sql = "select * from test_table where test_column = ?;";

let dialect = SQLiteDialect {}; // or AnsiDialect, or your own dialect ...

let ast = Parser::parse_sql(&dialect, sql).unwrap();

println!("AST: {:#?}", ast);
}
```

Any idea why I get this error message?:

_called `Result::unwrap()` on an `Err` value: ParserError("Expected an expression, found: ?")
thread 'dynamic_queries::go' panicked at 'called `Result::unwrap()` on an `Err` value: ParserError("Expected an expression, found: ?")',_

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先,使用 issue 中所示的参数化查询,通过带有 SQLiteDialect 的 Parser::parse_sql 重现该失败。阅读 parser 在 `?` token 附近的表达式处理,并查看评论线程以了解预期的参数表示方式。当受支持的 dialect 行为得到澄清或实现,并且该查询有 regression test 覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust, sql
领域
compilers, databases
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。