Class: Tarantool::Client::SqlResult

Inherits:
Data
  • Object
show all
Defined in:
tarantool-client/lib/tarantool/client/sql_result.rb

Overview

Rows and column names of an SQL query, or the counters of a data-changing statement.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#autoincrement_ids ⇒ Object (readonly)

Returns the value of attribute autoincrement_ids

Returns:

  • (Object) —

    the current value of autoincrement_ids



6
7
8
# File 'tarantool-client/lib/tarantool/client/sql_result.rb', line 6

def autoincrement_ids
  @autoincrement_ids
end

#columns ⇒ Object (readonly)

Returns the value of attribute columns

Returns:

  • (Object) —

    the current value of columns



6
7
8
# File 'tarantool-client/lib/tarantool/client/sql_result.rb', line 6

def columns
  @columns
end

#row_count ⇒ Object (readonly)

Returns the value of attribute row_count

Returns:

  • (Object) —

    the current value of row_count



6
7
8
# File 'tarantool-client/lib/tarantool/client/sql_result.rb', line 6

def row_count
  @row_count
end

#rows ⇒ Object (readonly)

Returns the value of attribute rows

Returns:

  • (Object) —

    the current value of rows



6
7
8
# File 'tarantool-client/lib/tarantool/client/sql_result.rb', line 6

def rows
  @rows
end

Class Method Details

.from_response(response) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'tarantool-client/lib/tarantool/client/sql_result.rb', line 7

def self.from_response(response)
  info = response.body.fetch(Protocol::Constants::SQL_INFO, {})

  new(
    rows: response.data || [],
    columns: column_names(response.body),
    row_count: info[Protocol::Constants::SQL_INFO_ROW_COUNT],
    autoincrement_ids: info.fetch(Protocol::Constants::SQL_INFO_AUTOINCREMENT_IDS, [])
  )
end