Class: PeaSelectResponse

Inherits:
PeaResponse show all
Defined in:
lib/pea_response.rb

Overview

Represents the concept of response in the case of a SELECT query executed on the database of an AS/400 server by a PeaClient object.

Instance Method Summary collapse

Methods inherited from PeaResponse

#has_succeeded, #sql_message, #sql_state

Constructor Details

#initialize(has_succeeded, sql_message, sql_state, result, row_count, columns_name) ⇒ PeaSelectResponse

Initialize a new instance of the PeaSelectResponse class.

Params:

has_succeeded

Boolean set to true if the query has correctly been executed. Set to true if the SQL state is 00000.

sql_message

SQL message return from the execution of the query.

sql_state

SQL state return from the execution of the query.

result

Results of the query in the form of an Dictionary where the columns’ name are the key and the values are the elements of this column in the SQL table.

row_count

Represents the number of rows that have been retreived by the query.

columns_name

Array representing the name of the columns in the order of the SELECT query.



124
125
126
127
128
129
130
# File 'lib/pea_response.rb', line 124

def initialize(has_succeeded, sql_message, sql_state, result, row_count, columns_name)
    super has_succeeded, sql_message, sql_state

    @result = result
    @row_count = row_count
    @columns_name = columns_name
end

Instance Method Details

#columns_nameObject



140
141
142
# File 'lib/pea_response.rb', line 140

def columns_name
    @columns_name
end

#resultObject



132
133
134
# File 'lib/pea_response.rb', line 132

def result
    @result
end

#row_countObject



136
137
138
# File 'lib/pea_response.rb', line 136

def row_count
    @row_count
end