-
Notifications
You must be signed in to change notification settings - Fork 200
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
Possible to make SQLite3::Statement#to_s more useful? #293
Comments
On
The gem throws away the SQL and bind params (after they're cast) because the statement doesn't need them anymore. We could modify the statement object to hold a reference, but that means the strings would live longer (IOW not get GC'd as quickly). Is improving |
When I wrote the issue, I was in the middle of a debugging session and really having difficulty figuring things out because the mental load was already high and working memory (my brain's, not the computer's) constantly at its limit. Reading your post, then mine again, I really do see your point. In production, SQLite is all about speed and efficiency. Perhaps this would need to be implemented as some sort of debugging flag. An environment variable switch, perhaps? |
I think that's a good idea. We could do something like: if $DEBUG
@query = the_string
end You can enable |
These methods allow you to retrieve the SQL statement that was used to create the statement object. The `sql` method just returns the sql statement, where the `expanded_sql` method returns the statement but with bind parameters substituted. This should aid with debugging and other tasks. Fixes #293
Hi, after trying to debug something for a while and not being able to figure out how to see the SQL produced by
sqlite3-ruby
I'm now wondering why the following is the way it is:An output like
would be more helpful and expected.
The text was updated successfully, but these errors were encountered: