|
From: James F.H. <jf...@ci...> - 2002-08-28 13:49:04
|
Is DBI silently catching exceptions?
The following code throws an exception and exits:
conn = Oracle.new("sys", "....")
begin
conn.exec("drop table foo")
print "table test droped\n"
end
/usr/local/lib/ruby/site_ruby/1.7/oracle.rb:101:in `parse':
ORA-00942: table or view does not exist (OCIError)
from /usr/local/lib/ruby/site_ruby/1.7/oracle.rb:101:in `parse'
from /usr/local/lib/ruby/site_ruby/1.7/oracle.rb:93:in `initialize'
from /usr/local/lib/ruby/site_ruby/1.7/oracle.rb:37:in `new'
from /usr/local/lib/ruby/site_ruby/1.7/oracle.rb:37:in `exec'
from oratest.rb:8
While this code silently finishes:
dbh = DBI.connect("dbi:Oracle:oradb", "sys", "....")
dbh.prepare("drop table foo") { |sth|
ret = sth.execute
}
Also, sqlsh.rb simply says "No rows affected" .
Is there another way to catch errors in DBI?
----------------------------------------------------------------------
| Jim Hranicky, Senior SysAdmin UF/CISE Department |
| E314D CSE Building Phone (352) 392-1499 |
| jf...@ci... http://www.cise.ufl.edu/~jfh |
----------------------------------------------------------------------
"Given a choice between a complex, difficult-to-understand, disconcerting
explanation and a simplistic, comforting one, many prefer simplistic
comfort if it's remotely plausible, especially if it involves blaming
someone else for their problems."
-- Bob Lewis, _Infoworld_
|