17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/active_record/oracle_enhanced_adapter_patch.rb', line 17
def columns_without_cache_with_pipelined(table, name)
begin
return columns_without_cache_without_pipelined(table, name)
rescue OracleEnhancedConnectionException => error
end
function_name, package_name = parse_function_name(table)
if package_name
function = plsql.send(package_name.downcase.to_sym)[function_name.downcase]
else
raise error.class, error.message
end
if function
arguments_metadata = function.arguments[0].sort_by {|arg| arg[1][:position]}
arguments = arguments_metadata.map do |(arg_name, argument)|
OracleEnhancedColumn.new(arg_name.to_s, nil, argument[:data_type], table)
end
return_columns = function.return[:element][:fields].sort_by {|(col_name, col)| col[:position]}.map do |(col_name, metadata)|
metadata.merge(name: col_name)
end
return_columns.map do |col|
OracleEnhancedColumn.new(col[:name].to_s, nil, col[:data_type], table)
end + arguments
else
raise error.class, error.message
end
end
|