/usr/lib/ruby/vendor_ruby/sequel/adapters/jdbc/sqlserver.rb is in ruby-sequel 3.33.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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | Sequel.require 'adapters/jdbc/mssql'
module Sequel
module JDBC
# Database and Dataset instance methods for SQLServer specific
# support via JDBC.
module SQLServer
# Database instance methods for SQLServer databases accessed via JDBC.
module DatabaseMethods
include Sequel::JDBC::MSSQL::DatabaseMethods
# Work around a bug in SQL Server JDBC Driver 3.0, where the metadata
# for the getColumns result set specifies an incorrect type for the
# IS_AUTOINCREMENT column. The column is a string, but the type is
# specified as a short. This causes getObject() to throw a
# com.microsoft.sqlserver.jdbc.SQLServerException: "The conversion
# from char to SMALLINT is unsupported." Using getString() rather
# than getObject() for this column avoids the problem.
# Reference: http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/20df12f3-d1bf-4526-9daa-239a83a8e435
module MetadataDatasetMethods
def process_result_set_convert(cols, result, rn)
while result.next
row = {}
cols.each do |n, i, p|
v = (n == :is_autoincrement ? result.getString(i) : result.getObject(i))
row[n] = if v
if p
p.call(v)
elsif p.nil?
cols[i-1][2] = p = convert_type_proc(v)
if p
p.call(v)
else
v
end
else
v
end
else
v
end
end
row.delete(rn) if rn
yield row
end
end
def process_result_set_no_convert(cols, result, rn)
while result.next
row = {}
cols.each do |n, i|
row[n] = (n == :is_autoincrement ? result.getString(i) : result.getObject(i))
end
row.delete(rn) if rn
yield row
end
end
end
def metadata_dataset
super.extend(MetadataDatasetMethods)
end
end
# Dataset class for SQLServer datasets accessed via JDBC.
class Dataset < JDBC::Dataset
include Sequel::MSSQL::DatasetMethods
end
end
end
end
|