class Sequel::ADO::MSSQL::Dataset

  1. lib/sequel/adapters/ado/mssql.rb
Superclass: Dataset

Methods

Public Instance

  1. insert
  2. provides_accurate_rows_matched?

Public Instance methods

insert(*values)

Use a nasty hack of multiple SQL statements in the same call and having the last one return the most recently inserted id. This is necessary as ADO’s default :provider uses a separate native connection for each query.

[show source]
   # File lib/sequel/adapters/ado/mssql.rb
49 def insert(*values)
50   return super if (@opts[:sql] && !@opts[:prepared_sql]) || @opts[:returning]
51   with_sql("SET NOCOUNT ON; #{insert_sql(*values)}; SELECT CAST(SCOPE_IDENTITY() AS INTEGER)").single_value
52 end
provides_accurate_rows_matched?()

If you use a better :provider option for the database, you can get an accurate number of rows matched.

[show source]
   # File lib/sequel/adapters/ado/mssql.rb
56 def provides_accurate_rows_matched?
57   !!db.opts[:provider]
58 end