Class WDDX::RecordSet
In: lib/wddx/record_set.rb
Parent: WddxData

Recordsets

Recordsets are tabular data encapsulations: a set of named fields with the same number of rows of data. Only simple data types can be stored in recordsets. For tabular data storage of complex data types, an array of structures should be used. Because some of the languages supported by WDDX are not case-sensitive, no two field names can differ only by their case. In the case where two fields have the same names or differ only by their case the final deserialized values will be the values from the last field. Field names must satisfy the regular expression [_A-Za-z]* where the ’.’ stands for a period, not ‘any character’.

 rows = []
 rows << [6, "MacBook Pro", 2000]
 rows << [10, "MacPro", 2200]
 rs = WDDX::RecordSet.new(["qty", "name", "price"], rows)
 WDDX.dump(rs)

Or

 rs = WDDX::RecordSet.new(["qty", "name", "price"])
 rs << [6, "MacBook Pro", 2000]
 puts rs.size # => 1

Methods

<<   fetch   fetch_fields   field_names   new   row_count   size  

Attributes

fields  [R] 

Public Class methods

Public Instance methods

Add an Array (one Row) with data fields

fetch_fields(field_name)

Alias for fetch

Return comma separated field names

Returns the number of rows in the Recordset

size()

Alias for row_count

[Validate]