class LogStash::Filters::Jdbc::ReadOnlyDatabase
Public Instance Methods
count(statement)
click to toggle source
# 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 # its the responsibility of the caller to manage the connections see Loader if connected? result = @db[statement].count else debug_log_messages.concat("and there is no connection to the remote db at this time") end rescue ::Sequel::Error => err # a fatal issue 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)
click to toggle source
# 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)
click to toggle source
# 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 # its the responsibility of the caller to manage the connections see Loader if connected? result = @db[statement].all else debug_log_messages.concat("and there is no connection to the remote db at this time") end rescue ::Sequel::Error => err # a fatal issue 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
Private Instance Methods
post_initialize()
click to toggle source
Calls superclass method
LogStash::Filters::Jdbc::BasicDatabase#post_initialize
# File lib/logstash/filters/jdbc/read_only_database.rb, line 53 def post_initialize() super end