Module | Sequel::JDBC::SQLServer::DatabaseMethods |
In: |
lib/sequel/adapters/jdbc/sqlserver.rb
|
Return instance of Sequel::JDBC::SQLServer::Dataset with the given opts.
# File lib/sequel/adapters/jdbc/sqlserver.rb, line 13 13: def dataset(opts=nil) 14: Sequel::JDBC::SQLServer::Dataset.new(self, opts) 15: end
# File lib/sequel/adapters/jdbc/sqlserver.rb, line 17 17: def metadata_dataset 18: ds = super 19: # Work around a bug in SQL Server JDBC Driver 3.0, where the metadata 20: # for the getColumns result set specifies an incorrect type for the 21: # IS_AUTOINCREMENT column. The column is a string, but the type is 22: # specified as a short. This causes getObject() to throw a 23: # com.microsoft.sqlserver.jdbc.SQLServerException: "The conversion 24: # from char to SMALLINT is unsupported." Using getString() rather 25: # than getObject() for this column avoids the problem. 26: # Reference: http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/20df12f3-d1bf-4526-9daa-239a83a8e435 27: def ds.result_set_object_getter 28: lambda do |result, n, i| 29: if n == :is_autoincrement 30: @convert_types ? convert_type(result.getString(i)) : result.getString(i) 31: else 32: @convert_types ? convert_type(result.getObject(i)) : result.getObject(i) 33: end 34: end 35: end 36: ds 37: end