Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#execute doesn't return anything under certain specific conditions #217

Closed
steinuil opened this issue May 5, 2017 · 2 comments
Closed

Comments

@steinuil
Copy link

steinuil commented May 5, 2017

I'm writing a web app and noticed that, under the very specific conditions that I tried to isolate in the snippet below, a SELECT query ran with #execute would return nothing.

https://gist.github.com/steinuil/bf5ffcc1b78fa62b4f3b1a11fdb98998

If I run this snippet and navigate to 0.0.0.0:8080/test, the first query using the string from rack's env will always fail, while the second one using a string literal will succeed.

Calling .dup or .clone on the string from rack's env won't work either, the only way is to construct another string entirely.

I ran the tests and they all pass.

SQLite version 3.17.0
gem version 1.3.13
Ruby version 2.4.0p0 (2016-12-24 revision 57164) [amd64-freebsd11]

@tenderlove
Copy link
Member

I can't tell for sure because the gist is deleted, but I think this is similar to #391. Database object can be shared among threads, but prepared statements cannot. I will write some documentation and guidance for threaded programming with SQLite3.

Thanks!

@steinuil
Copy link
Author

Sorry, I don't remember what happened to the snippet, but that sounds about what might have happened!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants