Class: LogStash::PluginMixins::Jdbc::ExplicitPagingModeStatementHandler
- Inherits:
-
PagedNormalStatementHandler
- Object
- StatementHandler
- NormalStatementHandler
- PagedNormalStatementHandler
- LogStash::PluginMixins::Jdbc::ExplicitPagingModeStatementHandler
- Defined in:
- lib/logstash/plugin_mixins/jdbc/statement_handler.rb
Instance Attribute Summary
Attributes inherited from NormalStatementHandler
Attributes inherited from StatementHandler
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.
Methods inherited from PagedNormalStatementHandler
Methods inherited from NormalStatementHandler
Methods inherited from StatementHandler
#build_query, build_statement_handler, #initialize
Constructor Details
This class inherits a constructor from LogStash::PluginMixins::Jdbc::PagedNormalStatementHandler
Instance Method Details
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, respecting our pagination settings, yielding once per row of data
110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 110 def perform_query(db, sql_last_value) query = build_query(db, sql_last_value) offset = 0 page_size = @jdbc_page_size loop do rows_in_page = 0 query.with_sql(query.sql, offset: offset, size: page_size).each do |row| yield row rows_in_page += 1 end break unless rows_in_page == page_size offset += page_size end end |