4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/oboe/inst/sequel.rb', line 4
def (sql, opts)
kvs = {}
if Oboe::Config[:sanitize_sql]
if sql.is_a?(Symbol)
kvs[:Query] = sql
else
kvs[:Query] = sql.gsub(/('[\s\S][^\']*\'|\d*\.\d*)/, '?')
end
else
kvs[:Query] = sql.to_s
kvs[:QueryArgs] = opts[:arguments] if opts.is_a?(Hash) and opts.key?(:arguments)
end
kvs[:IsPreparedStatement] = true if sql.is_a?(Symbol)
kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:sequel][:collect_backtraces]
if ::Sequel::VERSION < '3.41.0' && !(self.class.to_s =~ /Dataset$/)
db_opts = @opts
elsif @pool
db_opts = @pool.db.opts
else
db_opts = @db.opts
end
kvs[:Database] = db_opts[:database]
kvs[:RemoteHost] = db_opts[:host]
kvs[:RemotePort] = db_opts[:port] if db_opts.key?(:port)
kvs[:Flavor] = db_opts[:adapter]
rescue => e
Oboe.logger.debug "[oboe/debug Error capturing Sequel KVs: #{e.message}" if Oboe::Config[:verbose]
ensure
return kvs
end
|