Class: LogStash::PluginMixins::Jdbc::PagedNormalStatementHandler
- Inherits:
-
NormalStatementHandler
- Object
- StatementHandler
- NormalStatementHandler
- LogStash::PluginMixins::Jdbc::PagedNormalStatementHandler
- Defined in:
- lib/logstash/plugin_mixins/jdbc/statement_handler.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from NormalStatementHandler
Attributes inherited from StatementHandler
Instance Method Summary collapse
-
#initialize(plugin) ⇒ PagedNormalStatementHandler
constructor
A new instance of PagedNormalStatementHandler.
-
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, respecting our pagination settings, yielding once per row of data.
Methods inherited from StatementHandler
#build_query, build_statement_handler
Constructor Details
#initialize(plugin) ⇒ PagedNormalStatementHandler
Returns a new instance of PagedNormalStatementHandler.
74 75 76 77 78 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 74 def initialize(plugin) super(plugin) @jdbc_page_size = plugin.jdbc_page_size @logger = plugin.logger end |
Instance Method Details
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, respecting our pagination settings, yielding once per row of data
84 85 86 87 88 89 90 91 92 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 84 def perform_query(db, sql_last_value) query = build_query(db, sql_last_value) query.each_page(@jdbc_page_size) do |paged_dataset| log_dataset_page(paged_dataset) if @logger.debug? paged_dataset.each do |row| yield row end end end |