lib/sequel/adapters/tinytds.rb in sequel-4.34.0 vs lib/sequel/adapters/tinytds.rb in sequel-4.35.0
- old
+ new
@@ -16,11 +16,11 @@
c = TinyTds::Client.new(opts)
c.query_options.merge!(:cache_rows=>false)
if (ts = opts[:textsize])
sql = "SET TEXTSIZE #{typecast_value_integer(ts)}"
- log_yield(sql){c.execute(sql)}
+ log_connection_yield(sql, c){c.execute(sql)}
end
c
end
@@ -50,16 +50,16 @@
when :insert
sql = "#{sql}; SELECT CAST(SCOPE_IDENTITY() AS bigint) AS Ident"
single_value = true
end
sql = "EXEC sp_executesql N'#{c.escape(sql)}', N'#{c.escape(types.join(', '))}', #{values.join(', ')}"
- log_yield(sql) do
+ log_connection_yield(sql, c) do
r = c.execute(sql)
r.each{|row| return row.values.first} if single_value
end
else
- log_yield(sql) do
+ log_connection_yield(sql, c) do
r = c.execute(sql)
return r.send(m) if m
end
end
yield(r) if block_given?
@@ -137,19 +137,17 @@
super || (opts[:conn] && !opts[:conn].active?) || ((e.is_a?(::TinyTds::Error) && TINYTDS_DISCONNECT_ERRORS.match(e.message)))
end
# Dispose of any possible results of execution.
def log_connection_execute(conn, sql)
- log_yield(sql){conn.execute(sql).each}
+ log_connection_yield(sql, conn){conn.execute(sql).each}
end
# Return a 2 element array with the literal value and type to use
# in the prepared statement call for the given value and connection.
def ps_arg_type(v)
case v
- when Fixnum
- [v, 'int']
- when Bignum
+ when Integer
[v, 'bigint']
when Float
[v, 'double precision']
when Numeric
[v, 'numeric']