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 collapse
-
#jdbc_page_size ⇒ Object
readonly
Returns the value of attribute jdbc_page_size.
Attributes inherited from StatementHandler
#parameters, #statement, #statement_logger
Instance Method Summary collapse
-
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, respecting our pagination settings, yielding once per row of data.
- #post_init(plugin) ⇒ Object
Methods inherited from StatementHandler
#build_query, build_statement_handler, #initialize
Constructor Details
This class inherits a constructor from LogStash::PluginMixins::Jdbc::StatementHandler
Instance Attribute Details
#jdbc_page_size ⇒ Object (readonly)
Returns the value of attribute jdbc_page_size.
75 76 77 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 75 def jdbc_page_size @jdbc_page_size 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
81 82 83 84 85 86 87 88 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 81 def perform_query(db, sql_last_value) query = build_query(db, sql_last_value) query.each_page(@jdbc_page_size) do |paged_dataset| paged_dataset.each do |row| yield row end end end |
#post_init(plugin) ⇒ Object
90 91 92 93 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 90 def post_init(plugin) super(plugin) @jdbc_page_size = plugin.jdbc_page_size end |