Sha256: d3a63ef2c0acc73ee3a0edaa76684e037e64065a9fcde6e0a71e9b18fc241996
Contents?: true
Size: 764 Bytes
Versions: 20
Compression:
Stored size: 764 Bytes
Contents
module ActiveRecord module ConnectionAdapters class SQLServerAdapter def sql_for_insert(sql, pk, id_value, sequence_name, binds) sql = if pk && self.class.use_output_inserted # CPK # quoted_pk = SQLServer::Utils.extract_identifiers(pk).quoted # sql.insert sql.index(/ (DEFAULT )?VALUES/), " OUTPUT INSERTED.#{quoted_pk}" quoted_pks = [pk].flatten.map {|pk| "INSERTED.#{SQLServer::Utils.extract_identifiers(pk).quoted}"} sql.insert sql.index(/ (DEFAULT )?VALUES/), " OUTPUT #{quoted_pks.join(", ")}" else "#{sql}; SELECT CAST(SCOPE_IDENTITY() AS bigint) AS Ident" end # CPK # super [sql, binds] end end end end
Version data entries
20 entries across 20 versions & 1 rubygems