def sql_for_attribute_path( paths )
last_entity = @entity
last_attr = nil
re_path = ''
re = nil
paths.each_with_index do |path, index|
if (index + 1) == paths.size then
last_attr = last_entity.attribute path
re_path.chop!
_add_new_alias(re_path, re) if use_aliases?
_add_join_relationships(re_path, re)
else
re = last_entity.relationship(path)
last_entity = re.destination_entity
re_path << "#{path}."
_add_new_alias(path, re) if use_aliases?
_add_join_relationships(re_path.chop, re)
end
end
if use_aliases? then
another = @aliases[re_path]
else
another = nil
end
if another then
"#{another}.#{last_attr.column_name}"
else
"#{@last_entity.external_name}.#{last_attr.column_name}"
end
end