Class: LogStash::PluginMixins::Jdbc::PreparedStatementHandler
- Inherits:
-
StatementHandler
- Object
- StatementHandler
- LogStash::PluginMixins::Jdbc::PreparedStatementHandler
- Defined in:
- lib/logstash/plugin_mixins/jdbc/statement_handler.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from StatementHandler
Instance Method Summary collapse
-
#initialize(plugin) ⇒ PreparedStatementHandler
constructor
A new instance of PreparedStatementHandler.
-
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, ignoring our pagination settings, yielding once per row of data.
Methods inherited from StatementHandler
Constructor Details
#initialize(plugin) ⇒ PreparedStatementHandler
Returns a new instance of PreparedStatementHandler.
129 130 131 132 133 134 135 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 129 def initialize(plugin) super(plugin) @name = plugin.prepared_statement_name.to_sym @positional_bind_mapping = create_positional_bind_mapping(plugin.prepared_statement_bind_values).freeze @positional_bind_placeholders = @positional_bind_mapping.keys.map { |v| :"$#{v}" }.freeze end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
127 128 129 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 127 def name @name end |
Instance Method Details
#perform_query(db, sql_last_value) {|row| ... } ⇒ Object
Performs the query, ignoring our pagination settings, yielding once per row of data
141 142 143 144 145 146 |
# File 'lib/logstash/plugin_mixins/jdbc/statement_handler.rb', line 141 def perform_query(db, sql_last_value) query = build_query(db, sql_last_value) query.each do |row| yield row end end |