| Module | Sequel::JDBC::SQLServer::DatabaseMethods::MetadataDatasetMethods |
| In: |
lib/sequel/adapters/jdbc/sqlserver.rb
|
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
# File lib/sequel/adapters/jdbc/sqlserver.rb, line 22
22: def process_result_set_convert(cols, result)
23: while result.next
24: row = {}
25: cols.each do |n, i, p|
26: v = (n == :is_autoincrement ? result.getString(i) : result.getObject(i))
27: row[n] = if v
28: if p
29: p.call(v)
30: elsif p.nil?
31: cols[i-1][2] = p = convert_type_proc(v)
32: if p
33: p.call(v)
34: else
35: v
36: end
37: else
38: v
39: end
40: else
41: v
42: end
43: end
44: yield row
45: end
46: end