[Nitro] Og & Arrays/Hashes

Emmanuel Piperakis epiperak at softlab.ece.ntua.gr
Wed Oct 12 00:03:52 EDT 2005

Let me start by apologizing :-\
Og handles Arrays and complicated Hashes correctly after all. It must have 
been a bug of mine. So here are some examples that work fine with 0.23 Og 
and MySql. The only restriction is that Hashes have to be initialized 
(preferably in the constructor).

class Bgroup
   property   :title,    Hash
   property   :creation, Date
   property   :ar,       Array
   property   :ag,       Array
   property   :ara,      Hash

   def initialize
     @ar = Array.new(5, 'koko') # plain array of strings
     @ag = ['haha', 0, 0.0]     # array of mixed elements
     a = Array.new(5, 0)        # array of fixnum
     b = Array.new(6, 1.0)      # array of float
     c = Array.new(7, 'a')      # array of string
     @ara = Hash.new            # plain hash
     @ara[:koko] = a  # key => array of fixnum
     @ara[:kaka] = b  # key => array of float
     @ara[:keke] = c  # key => array of string
     @ara[:kiki] = [[0,1],[1,2],[2,3]] # key => array of arrays

All Arrays and Hashes are converted to text fields in MySql.

Anyway, hopefully the inheritance can be resolved somehow, and Og would be 
perfect! (as expected)

Emmanouil Piperakis (epiperak at cs.ntua.gr)
{To explore is Human, to Create is Devine,
  To teach is Primal, to Rule is Sin}

More information about the Nitro-general mailing list