Class: LogStash::Filters::Jdbc::ReadOnlyDatabase
Instance Attribute Summary
#unique_db_name
Instance Method Summary
collapse
#connect, #connected?, create, #disconnect, #empty_record_set, #initialize, random_name, wrap_error
Instance Method Details
#count(statement) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/logstash/filters/jdbc/read_only_database.rb', line 7
def count(statement)
result = 0
debug_log_messages = ["Lookup query count is zero"]
begin
if connected?
result = @db[statement].count
else
debug_log_messages << "and there is no connection to the remote db at this time"
end
rescue ::Sequel::Error => err
msg = "Exception occurred when executing loader Jdbc query count"
logger.error(msg, :exception => err.message, :backtrace => err.backtrace.take(8))
raise wrap_error(LookupJdbcException, err, msg)
end
logger.debug(debug_log_messages.join(' ')) if result.zero?
result
end
|
#post_create(connection_string, driver_class, driver_library, user, password) ⇒ Object
47
48
49
|
# File 'lib/logstash/filters/jdbc/read_only_database.rb', line 47
def post_create(connection_string, driver_class, driver_library, user, password)
verify_connection(connection_string, driver_class, driver_library, user, password)
end
|
#query(statement) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/logstash/filters/jdbc/read_only_database.rb', line 27
def query(statement)
result = empty_record_set
debug_log_messages = ["Lookup query results are empty"]
begin
if connected?
result = @db[statement].all
else
debug_log_messages << "and there is no connection to the remote db at this time"
end
rescue ::Sequel::Error => err
msg = "Exception occurred when executing loader Jdbc query"
logger.error(msg, :exception => err.message, :backtrace => err.backtrace.take(8))
raise wrap_error(LookupJdbcException, err, msg)
end
logger.debug(debug_log_messages.join(' ')) if result.empty?
result
end
|