Class: LogStash::PluginMixins::Jdbc::NormalStatementHandler
- Inherits:
-
StatementHandler
- Object
- StatementHandler
- LogStash::PluginMixins::Jdbc::NormalStatementHandler
- Defined in:
- lib/logstash/plugin_mixins/jdbc/statement_handler.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Attributes inherited from StatementHandler
Instance Method Summary collapse
-
#initialize(plugin) ⇒ NormalStatementHandler
constructor
A new instance of NormalStatementHandler.
-
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, yielding once per row of data.
Methods inherited from StatementHandler
Constructor Details
#initialize(plugin) ⇒ NormalStatementHandler
Returns a new instance of NormalStatementHandler.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 38 def initialize(plugin) super(plugin) @parameter_keys = ["sql_last_value"] + plugin.parameters.keys @parameters = plugin.parameters.inject({}) do |hash,(k,v)| case v when LogStash::Timestamp hash[k.to_sym] = v.time else hash[k.to_sym] = v end hash end end |
Instance Attribute Details
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
36 37 38 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 36 def parameters @parameters end |
Instance Method Details
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, yielding once per row of data
56 57 58 59 60 61 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 56 def perform_query(db, sql_last_value) query = build_query(db, sql_last_value) query.each do |row| yield row end end |