Need to add table_alias_length for oracle
-----------------------------------------

                 Key: JRUBY-1253
                 URL: http://jira.codehaus.org/browse/JRUBY-1253
             Project: JRuby
          Issue Type: Bug
          Components: ActiveRecord-JDBC
    Affects Versions: JRuby 1.0.0
            Reporter: Matthew Field
            Assignee: Thomas E Enebo


When there are multiple includes for relationships to the same table, the alias 
created for the tables should have its
name truncated in oracle.

For example

class ObjectOne < ActiveRecord::Base
  belongs_to :really_cool_object_two, :class_name => 'ObjectTwo' , :foreign_key 
=> 'cool_object_two'    
  belongs_to :really_not_cool_object_two, :class_name => 'ObjectTwo' , 
:foreign_key => 'not_cool_object_two'
end

class ObjectTwo < ActiveRecord::Base
end

if we do ObjectOne.find(:all, :include => [:really_cool_object_two, 
:not_cool_object_two])

the sql for will be

SELECT * --some stuff actually
  FROM object_ones
  LEFT OUTER JOIN object_twos ON object_twos.id =
                                         object_ones.cool_object_two
  LEFT OUTER JOIN object_twos really_not_cool_object_two_object_ones ON 
really_not_cool_object_two_object_ones
= object_ones.not_cool_object_two

This is not correct and will cause a "ORA-00972: identifier is too long" in 
oracle.  Using the regular active
record oracle we would get the table alais truncated.


Adding the following to the JdbcAdaptor class fixes this problem
for oracle.  This is obviously not the right place to do it or
it needs some conditional logic.

def table_alias_length
  30
end


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to