Class: ActiveRecord::ConnectionAdapters::Clickhouse::Statement::ResponseProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/clickhouse/statement/response_processor.rb

Constant Summary collapse

DB_EXCEPTION_REGEXP =
/\ACode:\s+\d+\.\s+DB::Exception:/.freeze

Instance Method Summary collapse

Constructor Details

#initialize(raw_response, format, sql) ⇒ ResponseProcessor

Returns a new instance of ResponseProcessor.



11
12
13
14
15
16
# File 'lib/active_record/connection_adapters/clickhouse/statement/response_processor.rb', line 11

def initialize(raw_response, format, sql)
  @raw_response = raw_response
  @body = raw_response.body
  @format = format
  @sql = sql
end

Instance Method Details

#processObject



18
19
20
21
22
23
24
25
26
# File 'lib/active_record/connection_adapters/clickhouse/statement/response_processor.rb', line 18

def process
  if success?
    process_successful_response
  else
    raise_database_error!
  end
rescue JSON::ParserError
  @body
end