Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6064

Show
Ignore:
Timestamp:
01/28/07 08:49:23 (2 years ago)
Author:
bitsweat
Message:

MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id. Closes #6778.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r6061 r6064  
    11*SVN* 
     2 
     3* MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id.  #6778 [Jonathan Viney, timc] 
    24 
    35* Use Date#to_s(:db) for quoted dates.  #7411 [Michael Schoen] 
  • trunk/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb

    r6044 r6064  
    389389          @connection.real_connect(*@connection_options) 
    390390          execute("SET NAMES '#{encoding}'") if encoding 
     391 
     392          # By default, MySQL 'where id is null' selects the last inserted id. 
     393          # Turn this off. http://dev.rubyonrails.org/ticket/6778 
     394          execute("SET SQL_AUTO_IS_NULL=0") 
    391395        end 
    392396 
  • trunk/activerecord/test/finder_test.rb

    r5876 r6064  
    461461  end 
    462462 
     463  # http://dev.rubyonrails.org/ticket/6778 
     464  def test_find_ignores_previously_inserted_record 
     465    post = Post.create! 
     466    assert_equal [], Post.find_all_by_id(nil) 
     467  end 
     468 
    463469  def test_find_by_empty_ids 
    464470    assert_equal [], Post.find([])