Class: VoltRb::ProcedureResponse
- Inherits:
-
Object
- Object
- VoltRb::ProcedureResponse
- Defined in:
- lib/voltrb/procedure_response.rb
Overview
An object of this class is returned by a call to Client#call_procedure.
response = client.call_procedure("Select", "Spanish")
Some VoltDB stored procedures return multiple rowsets. (Think of one rowset as the rows returned by a SQL select.) You get access to these array of rowsets (VoltTable objects) thru results.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
This is a plain Ruby hash derived from the JSON response from VoltDB.
Instance Method Summary collapse
- #app_status ⇒ Object
- #app_status_string ⇒ Object
-
#initialize(response) ⇒ ProcedureResponse
constructor
A new instance of ProcedureResponse.
-
#results ⇒ Object
Returns an array of VoltTable.
- #status ⇒ Object
- #status_string ⇒ Object
Constructor Details
#initialize(response) ⇒ ProcedureResponse
Returns a new instance of ProcedureResponse.
14 15 16 |
# File 'lib/voltrb/procedure_response.rb', line 14 def initialize(response) @raw = JSON.parse(response) end |
Instance Attribute Details
#raw ⇒ Object (readonly)
This is a plain Ruby hash derived from the JSON response from VoltDB. We can use this hash to access the entire response entity as an alternative to the object methods below. May save us a few CPU cycles. (Benchmark to be sure.) No conversions are done for values of type Decimal and Timestamp so we’ll have to handle those ourselves. We can also use the conversion functions in Utils
12 13 14 |
# File 'lib/voltrb/procedure_response.rb', line 12 def raw @raw end |
Instance Method Details
#app_status ⇒ Object
26 27 28 |
# File 'lib/voltrb/procedure_response.rb', line 26 def app_status @app_status ||= @raw["appstatus"] end |
#app_status_string ⇒ Object
30 31 32 |
# File 'lib/voltrb/procedure_response.rb', line 30 def app_status_string @app_status_string ||= @raw["appstatusstring"] end |
#results ⇒ Object
Returns an array of VoltTable.
35 36 37 |
# File 'lib/voltrb/procedure_response.rb', line 35 def results @results ||= hydrate_results end |
#status ⇒ Object
18 19 20 |
# File 'lib/voltrb/procedure_response.rb', line 18 def status @status ||= @raw["status"] end |
#status_string ⇒ Object
22 23 24 |
# File 'lib/voltrb/procedure_response.rb', line 22 def status_string @status_string ||= @raw["statusstring"] end |