module Sequel::JDBC::SQLServer::DatabaseMethods::MetadataDatasetMethods

  1. lib/sequel/adapters/jdbc/sqlserver.rb
Parent: 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: social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/20df12f3-d1bf-4526-9daa-239a83a8e435

Public Instance methods

process_result_set_convert (cols, result)
[show source]
# File lib/sequel/adapters/jdbc/sqlserver.rb, line 22
def process_result_set_convert(cols, result)
  while result.next
    row = {}
    cols.each do |n, i, ctn, 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][3] = p = convert_type_proc(v, ctn)
          if p
            p.call(v)
          else
            v
          end
        else
          v
        end
      else
        v
      end
    end
    yield row
  end
end
process_result_set_no_convert (cols, result)
[show source]
# File lib/sequel/adapters/jdbc/sqlserver.rb, line 48
def process_result_set_no_convert(cols, result)
  while result.next
    row = {}
    cols.each do |n, i|
      row[n] = (n == :is_autoincrement ? result.getString(i) : result.getObject(i))
    end
    yield row
  end
end