For example, if I do a query and misspell foobar as foober:
irb(main):007:0> require 'sqlite3'
=> false
irb(main):008:0> db = SQLite3::Database.new("test.db")
=> #<SQLite3::Database:0xb7b28e34
@driver=#<SQLite3::Driver::Native::Driver:0xb7b28d94 @trace={},
@busy_handler={}, @authorizer={}, @callback_data={}>,
@transaction_active=false, @closed=false,
@handle=#<SWIG::TYPE_p_sqlite3:0xb7b28c40>, @translator=nil,
@statement_factory=SQLite3::Statement, @type_translation=false,
@results_as_hash=false>
irb(main):009:0> db.execute2("select * from foobar")
=> [["foo", "bar"], ["hello", "1"], ["world", "2"]]
irb(main):010:0> db.execute2("select * from foober")
/usr/lib/ruby/1.8/sqlite3/errors.rb:94:in `check': no such table:
foober (SQLite3::SQLException)
from /usr/lib/ruby/1.8/sqlite3/statement.rb:71:in `initialize'
from /usr/lib/ruby/1.8/sqlite3/database.rb:184:in `new'
from /usr/lib/ruby/1.8/sqlite3/database.rb:184:in `prepare'
from /usr/lib/ruby/1.8/sqlite3/database.rb:232:in `execute2'
from (irb):10:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52
$
I would prefer that the error message get shown and then continue inside irb.
Thanks in advance to any pointers.
Regards,
- Robert