Provide the erroneous query in the SQLException class
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start at the db.execute entry point and trace how SQLite3::SQLException is created across the Ruby binding and its C implementation. Determine how the failing SQL can be retained on the exception, then verify that rescuing the exception exposes the query shown in the issue without changing the existing error message.
Written by the indexing model from the issue text.
Description
Would be good to be able to pull the specific query that caused the error from the SQLException class. For example:
begin
ids = ids.join(",")
db.execute("SELECT * FROM table WHERE id IN(#{ids});")
rescue SQLite3::SQLException => e
log.error e.message # near ",": syntax error
# (WTF?)
log.debug e.query # SELECT * FROM table WHERE id IN(,1,2,3,4);
# (oh, right there's a nil entry in the array)
end
Gives some context to the particular SQL error that happened, assisting in troubleshooting code. I would submit a pull request, but I can't see in the code where I could set a attribute on the exception class (looks like it's done from C?).
Cheers
- Dominant language
- Ruby
- Stars
- 845
- Forks
- 220
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 3
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.
More from sparklemotion/sqlite3-ruby
-
needs-more-info
Difficulty 3/5 1-2 days Newbie friendliness 42/100
sparklemotion/sqlite3-ruby#653 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sparklemotion/sqlite3-ruby#639 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
sparklemotion/sqlite3-ruby#628 · 10 comments · 1 reaction ·
-
bug help-wanted platform/windows
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sparklemotion/sqlite3-ruby#618 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sparklemotion/sqlite3-ruby#573 · 2 comments ·
All issues in sparklemotion/sqlite3-ruby
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bensheldon/good_job#1816 · 5 comments ·