lib/sequel/adapters/tinytds.rb in sequel-3.21.0 vs lib/sequel/adapters/tinytds.rb in sequel-3.22.0

- old
+ new

@@ -11,10 +11,11 @@ # :dataserver and :username options. def connect(server) opts = server_opts(server) opts[:dataserver] = opts[:host] opts[:username] = opts[:user] + set_mssql_unicode_strings TinyTds::Client.new(opts) end # Return instance of Sequel::TinyTDS::Dataset with the given options. def dataset(opts = nil) @@ -36,11 +37,11 @@ r = c.execute(sql) return r.send(m) if m end yield(r) if block_given? rescue TinyTds::Error => e - raise_error(e) + raise_error(e, :disconnect=>(c.closed? || (c.respond_to?(:dead?) && c.dead?))) ensure r.cancel if r && c.sqlsent? end end end @@ -105,21 +106,21 @@ result.each(each_opts) do |r| r.delete(row_number_column) if offset yield r end else - result.each(each_opts, &block) + result.each(each_opts, &Proc.new) end end end self end private # Properly escape the given string +v+. def literal_string(v) - db.synchronize{|c| "N'#{c.escape(v)}'"} + s = db.synchronize{|c| "#{'N' if mssql_unicode_strings}'#{c.escape(v)}'"} end end end end