lib/og/adapters/mysql.rb in og-0.13.0 vs lib/og/adapters/mysql.rb in og-0.14.0

- old
+ new

@@ -1,10 +1,15 @@ # * George Moschovitis <gm@navel.gr> # (c) 2004-2005 Navel, all rights reserved. -# $Id: mysql.rb 281 2005-03-10 12:24:14Z gmosx $ +# $Id: mysql.rb 326 2005-03-28 11:07:17Z gmosx $ -require 'mysql' +begin + require 'mysql' +rescue Object => ex + Logger.error 'Ruby-Mysql bindings are not installed!' + Logger.error ex +end require 'og/adapter' require 'og/connection' require 'glue/attribute' @@ -273,24 +278,21 @@ Logger.debug sql if $DBG begin @store.query_with_result = true return @store.query(sql) rescue => ex - Logger.error "DB error #{ex}, [#{sql}]" - Logger.error ex.backtrace.join("\n") - return nil + handle_db_exception(ex, sql) end end def exec(sql) Logger.debug sql if $DBG begin @store.query_with_result = false @store.query(sql) rescue => ex - Logger.error "DB error #{ex}, [#{sql}]" - Logger.error ex.backtrace.join("\n") + handle_db_exception(ex, sql) end end def start # @store.transaction @@ -339,9 +341,13 @@ def read_int(res, idx = 0) val = res.fetch_row[idx].to_i res.free return val + end + + def get_row(res) + res.fetch_row end end end