Permalink
Browse files

Fix MSSQL default_constraint_name on JRuby 1.7

JRuby 1.7 defines BasicObject#object_id, whereas MRI does not.
Maybe that is a bug in JRuby 1.7, but it's simple to work around.
  • Loading branch information...
1 parent 82d4e54 commit 0391d18bde6662b61a8bb60d2e14cfef1b22ce51 @jeremyevans committed Oct 22, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/sequel/adapters/shared/mssql.rb
@@ -245,7 +245,7 @@ def default_constraint_name(table, column_name)
if server_version >= 9000000
table_name = schema_and_table(table).compact.join('.')
self[:sys__default_constraints].
- where{{:parent_object_id => object_id(table_name), col_name(:parent_object_id, :parent_column_id) => column_name.to_s}}.
+ where{{:parent_object_id => Sequel::SQL::Function.new(:object_id, table_name), col_name(:parent_object_id, :parent_column_id) => column_name.to_s}}.
get(:name)
end
end

0 comments on commit 0391d18

Please sign in to comment.