/usr/lib/ruby/vendor_ruby/sequel/adapters/jdbc/mssql.rb is in ruby-sequel 4.15.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | Sequel.require 'adapters/shared/mssql'
module Sequel
module JDBC
class Database
# Alias the generic JDBC version so it can be called directly later
alias jdbc_schema_parse_table schema_parse_table
end
# Database and Dataset instance methods for MSSQL specific
# support via JDBC.
module MSSQL
# Database instance methods for MSSQL databases accessed via JDBC.
module DatabaseMethods
extend Sequel::Database::ResetIdentifierMangling
PRIMARY_KEY_INDEX_RE = /\Apk__/i.freeze
ATAT_IDENTITY = 'SELECT @@IDENTITY'.freeze
SCOPE_IDENTITY = 'SELECT SCOPE_IDENTITY()'.freeze
include Sequel::MSSQL::DatabaseMethods
private
# Get the last inserted id using SCOPE_IDENTITY().
def last_insert_id(conn, opts=OPTS)
statement(conn) do |stmt|
sql = opts[:prepared] ? ATAT_IDENTITY : SCOPE_IDENTITY
rs = log_yield(sql){stmt.executeQuery(sql)}
rs.next
rs.getInt(1)
end
end
# Call the generic JDBC version instead of MSSQL version,
# since the JDBC version handles primary keys.
def schema_parse_table(table, opts=OPTS)
jdbc_schema_parse_table(table, opts)
end
# Primary key indexes appear to start with pk__ on MSSQL
def primary_key_index_re
PRIMARY_KEY_INDEX_RE
end
end
end
end
end
|