Hi Jeremy, Will the db << string syntax raise an error if there is something wrong with the SQL? And can I execute the SQL inside a transaction, to rollback everything in case something goes wrong?
Shawn On Aug 4, 8:23 am, Jeremy Evans <[email protected]> wrote: > On Aug 4, 1:26 am, Shawn Van Ittersum <[email protected]> wrote: > > > Hmm, when I change the code to db.execute(), I get this error: > > > /usr/local/lib/ruby/gems/1.8/gems/sequel-3.2.0/lib/sequel/adapters/ > > mysql.rb:196:in `close': Mysql::Error: Commands out of sync; you can't > > run this command now (Sequel::DatabaseError) > > You almost never want to use Database#execute directly, as the API is > adapter dependent. You may want to use db << File.read(filename), > which is the method to use if you want to just run the SQL against the > database and you don't care about the result. > > Note that most adapters will not take multiple SQL statements in a > single call, but the MySQL adapter is one of the few that will. > > 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 -~----------~----~----~----~------~----~------~--~---
