Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit e70d625

Browse files
bors[bot]Glauber Costa
andauthored
Merge #359
359: pass create virtual table statements through r=psarna a=glommer This is a temporary workaround for gwenn/lemon-rs#30 It passes through the CREATE VIRTUAL TABLE statement Ref #358 Co-authored-by: Glauber Costa <[email protected]>
2 parents 183e50e + 8f926d2 commit e70d625

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sqld/src/query_analysis.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,20 @@ impl Statement {
175175
}
176176

177177
pub fn parse(s: &str) -> impl Iterator<Item = Result<Self>> + '_ {
178-
fn parse_inner(c: Cmd) -> Result<Statement> {
178+
fn parse_inner(original: &str, c: Cmd) -> Result<Statement> {
179179
let kind =
180180
StmtKind::kind(&c).ok_or_else(|| anyhow::anyhow!("unsupported statement"))?;
181+
182+
// XXX: Temporary workaround for https://github.com/gwenn/lemon-rs/issues/30
183+
if let Cmd::Stmt(Stmt::CreateVirtualTable { .. }) = &c {
184+
return Ok(Statement {
185+
stmt: original.to_string(),
186+
kind,
187+
is_iud: false,
188+
is_insert: false,
189+
});
190+
}
191+
181192
let is_iud = matches!(
182193
c,
183194
Cmd::Stmt(Stmt::Insert { .. } | Stmt::Update { .. } | Stmt::Delete { .. })
@@ -198,7 +209,7 @@ impl Statement {
198209
// - https://github.com/gwenn/lemon-rs/pull/19
199210
let mut parser = Box::new(Parser::new(s.as_bytes()));
200211
std::iter::from_fn(move || match parser.next() {
201-
Ok(Some(cmd)) => Some(parse_inner(cmd)),
212+
Ok(Some(cmd)) => Some(parse_inner(s, cmd)),
202213
Ok(None) => None,
203214
Err(sqlite3_parser::lexer::sql::Error::ParserError(
204215
ParserError::SyntaxError {

0 commit comments

Comments
 (0)