81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/que/connection.rb', line 81
def execute_prepared(command, params = nil)
Que.assert(Symbol, command)
if !Que.use_prepared_statements || in_transaction?
return execute(command, params)
end
name = "que_#{command}"
begin
unless @prepared_statements.include?(command)
wrapped_connection.prepare(name, SQL[command])
@prepared_statements.add(command)
prepared_just_now = true
end
convert_result(
wrapped_connection.exec_prepared(name, params)
)
rescue ::PG::InvalidSqlStatementName => error
unless prepared_just_now
Que.log level: :warn, event: :reprepare_statement, command: command
@prepared_statements.delete(command)
retry
end
raise error
end
end
|