Cannot execute multiple statements with one call

Open
#3 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, react-native, sqlite

Research direction

Start in cpp/sqliteBridge.cpp around the sqliteExecute prepare call at line 260, and inspect how the unused pzTail value is handled. Reproduce the two-statement script, then determine whether the interface should execute all statements or report trailing SQL; done means the behavior is explicit and no statement is silently ignored.

Written by the indexing model from the issue text.

Description

bug

Consider the following sql script:

CREATE TABLE foo (id INTEGER);
CREATE TABLE bar (id INTEGER);

With the current interface, only the first statement will be executed and no error is given. I would've expected to have the whole sql script executed, or at least to get an error.

I digged through the code, and found out that the pzTail parameter is unused in the sqliteExecute's prepare call:

https://github.com/margelo/react-native-quick-sqlite/blob/d70108549e7d5855a497dc14be25e7dafb00524c/cpp/sqliteBridge.cpp#L260

Apparently that pointer gets populated with the remaining text that is yet to be processed: https://sqlite.org/forum/info/2a9775b88a90d2e6.

Dominant language
C
Stars
565
Forks
53
Avg merge
3d 13h
Merged PRs (30d)
28

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from margelo/react-native-nitro-sqlite

All issues in margelo/react-native-nitro-sqlite

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.