diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-28 08:49:23 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-28 08:49:23 +0000 |
commit | 8f5c12e451cc0ad5e3a9dd54f1fe882acae5b83b (patch) | |
tree | d98ebb0efde8ad18cb84b193bfd907ebb281a6e6 /activerecord/lib | |
parent | 799f556fe1795c0c94dd5bf09ca84426e861de33 (diff) | |
download | rails-8f5c12e451cc0ad5e3a9dd54f1fe882acae5b83b.tar.gz rails-8f5c12e451cc0ad5e3a9dd54f1fe882acae5b83b.tar.bz2 rails-8f5c12e451cc0ad5e3a9dd54f1fe882acae5b83b.zip |
MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id. Closes #6778.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 08b3c22ec7..842258f1ea 100755 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -388,6 +388,10 @@ module ActiveRecord @connection.ssl_set(@config[:sslkey], @config[:sslcert], @config[:sslca], @config[:sslcapath], @config[:sslcipher]) if @config[:sslkey] @connection.real_connect(*@connection_options) execute("SET NAMES '#{encoding}'") if encoding + + # By default, MySQL 'where id is null' selects the last inserted id. + # Turn this off. http://dev.rubyonrails.org/ticket/6778 + execute("SET SQL_AUTO_IS_NULL=0") end def select(sql, name = nil) |