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/ridgepole/execute_expander.rb', line 23
def expand_execute(connection)
return if connection.respond_to?(:execute_with_noop)
class << connection
def execute_with_noop(sql, name = nil)
if Ridgepole::ExecuteExpander.noop
if (callback = Ridgepole::ExecuteExpander.callback)
callback.call(sql, name)
end
if sql =~ /\A(SELECT|SHOW)\b/i
begin
execute_without_noop(sql, name)
rescue => e
Stub.new
end
else
Stub.new
end
else
execute_without_noop(sql, name)
end
end
alias_method_chain :execute, :noop
end
end
|