Module | Sequel::ADO::MSSQL::DatabaseMethods |
In: |
lib/sequel/adapters/ado/mssql.rb
|
ROWS_AFFECTED | = | "SELECT @@ROWCOUNT AS AffectedRows" | Query to use to get the number of rows affected by an update or delete query. |
Issue a separate query to get the rows modified. ADO appears to use pass by reference with an integer variable, which is obviously not supported directly in ruby, and I‘m not aware of a workaround.
# File lib/sequel/adapters/ado/mssql.rb, line 20 20: def execute_dui(sql, opts=OPTS) 21: return super unless @opts[:provider] 22: synchronize(opts[:server]) do |conn| 23: begin 24: log_connection_yield(sql, conn){conn.Execute(sql)} 25: res = log_connection_yield(ROWS_AFFECTED, conn){conn.Execute(ROWS_AFFECTED)} 26: res.getRows.transpose.each{|r| return r.shift} 27: rescue ::WIN32OLERuntimeError => e 28: raise_error(e) 29: end 30: end 31: end