Module: ChDB::ResultHandler

Included in:
Statement
Defined in:
lib/chdb/result_handler.rb

Overview

This module provides a set of methods for handling the results of a ChDB query. It parses the output content into a CSV table and provides methods to iterate over the rows.

Class Method Summary collapse

Class Method Details

.done?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/chdb/result_handler.rb', line 24

def done?
  @row_idx >= @parsed_data.size
end

.parse_output(output_content) ⇒ Object



9
10
11
12
# File 'lib/chdb/result_handler.rb', line 9

def parse_output(output_content)
  csv_table = CSV.parse(output_content, headers: true)
  [csv_table.headers, csv_table.map(&:fields)]
end

.stepObject



14
15
16
17
18
19
20
# File 'lib/chdb/result_handler.rb', line 14

def step
  return nil if @row_idx >= @parsed_data.size

  current_row = @parsed_data[@row_idx]
  @row_idx += 1
  current_row
end