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

Changeset 5073

Show
Ignore:
Timestamp:
09/08/06 18:14:02 (3 years ago)
Author:
david
Message:

Added parentheses around FROM clauses generated by Base and associations since MySQL 5 claim that to be the standard (and will screw up joins if its not there), see http://bugs.mysql.com/bug.php?id=13551 [DHH]

Files:

Legend:

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

    r5067 r5073  
    11*SVN* 
     2 
     3* Added parentheses around FROM clauses generated by Base and associations since MySQL 5 claim that to be the standard (and will screw up joins if its not there), see http://bugs.mysql.com/bug.php?id=13551 [DHH] 
    24 
    35* Rename AR::Base#quote so people can use that name in their models. #3628 [Koz] 
  • trunk/activerecord/lib/active_record/associations.rb

    r5018 r5073  
    11321132        def construct_finder_sql_with_included_associations(options, join_dependency) 
    11331133          scope = scope(:find) 
    1134           sql = "SELECT #{column_aliases(join_dependency)} FROM #{(scope && scope[:from]) || options[:from] || table_name}
     1134          sql = "SELECT #{column_aliases(join_dependency)} FROM (#{(scope && scope[:from]) || options[:from] || table_name})
    11351135          sql << join_dependency.join_associations.collect{|join| join.association_join }.join 
    11361136  
  • trunk/activerecord/lib/active_record/base.rb

    r5018 r5073  
    10901090          scope = scope(:find) 
    10911091          sql  = "SELECT #{(scope && scope[:select]) || options[:select] || '*'} " 
    1092           sql << "FROM #{(scope && scope[:from]) || options[:from] || table_name}
     1092          sql << "FROM (#{(scope && scope[:from]) || options[:from] || table_name})
    10931093 
    10941094          add_joins!(sql, options, scope)