On Nov 19, 7:45 pm, "Adam Wiggins" <[EMAIL PROTECTED]> wrote: > Obligatory first-post gushing: Sequel rules, it's my new favorite ORM. > > With that out of the way - > > I want to add display of the SQL query whenever an exception occurs. > That is, instead of this: > > Exception SQLite3::SQLException near "table": syntax error > /usr/lib/ruby/1.8/sqlite3/errors.rb:94:in `check' > /usr/lib/ruby/1.8/sqlite3/statement.rb:71:in `initialize' > ... > > I want to show: > > Query: "SELECT * FROM table" > Exception SQLite3::SQLException near "table": syntax error > /usr/lib/ruby/1.8/sqlite3/errors.rb:94:in `check' > /usr/lib/ruby/1.8/sqlite3/statement.rb:71:in `initialize' > ... > > I was able to add this easily to the sqlite adapter (in the _execute) method: > > rescue SQLite3::Exception => e > puts sql > raise_error(e) > end > > ...but I could not find a common entry point for all queries on the > base adapter. Any thoughts on where this can be implemented cleanly > and in a way that is common across all adapters?
No. You can log all queries by setting up a database logger. Logging on exception would need to be done in every rescue statement, so it would require significant (though probably not too difficult) modifications. If you give a shot at a patch, I'll certainly consider it. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
