Ticket #3782: fix_crash_with_mysql_views_2.patch
| File fix_crash_with_mysql_views_2.patch, 1.7 kB (added by jonathan@bluewire.net.nz, 3 years ago) |
|---|
-
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
old new 236 236 # SCHEMA STATEMENTS ======================================== 237 237 238 238 def structure_dump #:nodoc: 239 select_all("SHOW TABLES").inject("") do |structure, table| 239 if supports_views? 240 sql = "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'" 241 else 242 sql = "SHOW TABLES" 243 end 244 245 select_all(sql).inject("") do |structure, table| 246 table.delete('Table_type') 240 247 structure += select_one("SHOW CREATE TABLE #{table.to_a.first.last}")["Create Table"] + ";\n\n" 241 248 end 242 249 end … … 334 341 result.free 335 342 rows 336 343 end 344 345 def supports_views? 346 version[0] >= 5 347 end 348 349 def version 350 @version ||= @connection.server_info.scan(/^(\d+)\.(\d+)\.(\d+)/).flatten.map { |v| v.to_i } 351 end 337 352 end 338 353 end 339 354 end -
activerecord/CHANGELOG
old new 1 1 *SVN* 2 2 3 * Stop the MySQL adapter crashing when views are present. #3782 [Jonathan Viney] 4 3 5 * Allow set_fixture_class to take Classes instead of strings for a class in a module. Raise FixtureClassNotFound if a fixture can't load. [Rick Olson] 4 6 5 7 * Fix quoting of inheritance column for STI eager loading #4098 [Jonathan Viney <jonathan@bluewire.net.nz>]