diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb | 2 | ||||
-rw-r--r-- | activerecord/test/pk_test.rb | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index c5b2f9838c..4ac63d1245 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY. #2866 [kajism@yahoo.com, Tom Ward <tom@popdog.net>] + * Oracle: active? and reconnect! methods for handling stale connections. Optionally retry queries after reconnect. #428 [Michael Schoen <schoenm@earthlink.net>] * Correct documentation for Base.delete_all. #1568 [Newhydra] diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb index fecc6a7e1c..ec85c88c61 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb @@ -236,7 +236,7 @@ module ActiveRecord end log(sql, name) do @connection.execute(sql) - select_one("SELECT @@IDENTITY AS Ident")["Ident"] + id_value || select_one("SELECT @@IDENTITY AS Ident")["Ident"] end ensure if ii_enabled diff --git a/activerecord/test/pk_test.rb b/activerecord/test/pk_test.rb index f9cfd6f293..839a784e4a 100644 --- a/activerecord/test/pk_test.rb +++ b/activerecord/test/pk_test.rb @@ -54,6 +54,7 @@ class PrimaryKeysTest < Test::Unit::TestCase assert_equal("jdoe", subscriber.id) subscriber.name = "John Doe" assert_nothing_raised { subscriber.save! } + assert_equal("jdoe", subscriber.id) subscriberReloaded = Subscriber.find("jdoe") assert_equal("John Doe", subscriberReloaded.name) |