public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/ddollar/rails.git
Search Repo:
 r3392@asus:  jeremy | 2005-12-07 21:10:42 -0800
 Apply [3246] to stable.  MySQL: more robust test for nullified result 
 hashes.  Closes #3124.


git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@3247 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jeremy (author)
Wed Dec 07 21:11:38 -0800 2005
commit  a9f4205b21d3cca95bd3985e09b84be289983fcf
tree    42b663bab502436a0b9dd1b93b3cb7900f3bd146
parent  8a19d148b7ae29872c1a7314a09bb14d338fc390
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 * SVN*
0
 
0
+* MySQL: more robust test for nullified result hashes. #3124 [Stefan Kaes]
0
+
0
 * SQLite: find database file when RAILS_ROOT is a symlink. #3116 [anna@wota.jp]
0
 
0
 * Reloading an instance refreshes its aggregations as well as its associations. #3024 [François Beausolei]
...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
87
88
89
90
91
92
93
94
95
...
100
101
102
 
103
104
105
...
341
342
343
344
 
345
346
347
...
8
9
10
 
 
11
12
13
14
 
 
15
16
17
...
83
84
85
 
 
 
86
87
88
...
93
94
95
96
97
98
99
...
335
336
337
 
338
339
340
341
0
@@ -8,14 +8,10 @@ module ActiveRecord
0
       unless defined? Mysql
0
         begin
0
           require_library_or_gem 'mysql'
0
- # The C version of mysql returns null fields in each_hash if Mysql::VERSION is defined
0
- ConnectionAdapters::MysqlAdapter.null_values_in_each_hash = Mysql.const_defined?(:VERSION)
0
         rescue LoadError => cannot_require_mysql
0
           # Only use the supplied backup Ruby/MySQL driver if no driver is already in place
0
           begin
0
             require 'active_record/vendor/mysql'
0
- # The ruby version of mysql returns null fields in each_hash
0
- ConnectionAdapters::MysqlAdapter.null_values_in_each_hash = true
0
           rescue LoadError
0
             raise cannot_require_mysql
0
           end
0
@@ -87,9 +83,6 @@ module ActiveRecord
0
       @@emulate_booleans = true
0
       cattr_accessor :emulate_booleans
0
 
0
- cattr_accessor :null_values_in_each_hash
0
- @@null_values_in_each_hash = false
0
-
0
       LOST_CONNECTION_ERROR_MESSAGES = [
0
         "Server shutdown in progress",
0
         "Broken pipe",
0
@@ -100,6 +93,7 @@ module ActiveRecord
0
       def initialize(connection, logger, connection_options=nil, mysql=Mysql)
0
         super(connection, logger)
0
         @connection_options = connection_options
0
+ @null_values_in_each_hash = Mysql.const_defined?(:VERSION)
0
         @mysql = mysql
0
       end
0
 
0
@@ -341,7 +335,7 @@ module ActiveRecord
0
           @connection.query_with_result = true
0
           result = execute(sql, name)
0
           rows = []
0
- if @@null_values_in_each_hash
0
+ if @null_values_in_each_hash
0
             result.each_hash { |row| rows << row }
0
           else
0
             all_fields = result.fetch_fields.inject({}) { |fields, f| fields[f.name] = nil; fields }

Comments

    No one has commented yet.