Class: Sneaql::Core::Commands::SneaqlRecordsetFromQuery

Inherits:
SneaqlCommand
  • Object
show all
Defined in:
lib/sneaql_lib/core.rb

Overview

runs the query then stores the array of hashes into the recordset hash

Instance Method Summary collapse

Methods inherited from SneaqlCommand

#initialize, #valid_expression?, #valid_operator?, #valid_recordset?, #valid_symbol?, #valid_variable?, #validate_args

Constructor Details

This class inherits a constructor from Sneaql::Core::SneaqlCommand

Instance Method Details

#action(recordset_name) ⇒ Object

Parameters:

  • recordset_name (String)

    name of the recordset in which to store the results



232
233
234
235
236
237
238
# File 'lib/sneaql_lib/core.rb', line 232

def action(recordset_name)
  r = query_results
  @logger.info "adding #{r.length} recs as #{recordset_name}"
  @recordset_manager.store_recordset(recordset_name, r)
rescue => e
  @exception_manager.pending_error = e
end

#arg_definitionObject

argument types



241
242
243
# File 'lib/sneaql_lib/core.rb', line 241

def arg_definition
  [:recordset]
end

#query_resultsArray

Returns array of hashes from SQL results

Returns:

  • (Array)

    returns array of hashes from SQL results



246
247
248
249
250
251
252
# File 'lib/sneaql_lib/core.rb', line 246

def query_results
  JDBCHelpers::QueryResultsToArray.new(
    @jdbc_connection,
    @statement,
    @logger
  ).results
end