margelo / margelo/react-native-nitro-sqlite
Cannot execute multiple statements with one call
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 565
- Forks
- 53
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 18
Description
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:
Apparently that pointer gets populated with the remaining text that is yet to be processed: https://sqlite.org/forum/info/2a9775b88a90d2e6.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- cpp, react-native, sqlite
- Domain
- databases, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100