[Nitro] Storing binary data

Michael Neumann mneumann at ntecs.de
Wed Jun 15 13:27:54 EDT 2005

Am Wednesday 15 June 2005 14:16 schrieb George Moschovitis:
> Hello Michael,
> It seems to me that this is a patch for an older version of Og (more
> than a month old).

Yes, it' s for Og 0.16.0.

> Out of curiosity, why is that?

Just because I am using it and have made some minor changes to it. I'd need to 
test it out with a newer version, but there's currently no need to "upgrade" 
and little time ;-)

BYTEA columns have one problem. If you fetch an object, the whole data of the 
BYTEA column is retrieved as well. This might take a long time if the data is 
big. Two solutions:

* lazy column/property loading, e.g.

  property :data, Og::Binary, :lazy => true

  would generate the following method:

  def data
    if @cached_data
      @cached_data = exec("select data from tablename where oid=#{self.oid}")

* BLOBs (they must be implemented lazily too).



More information about the Nitro-general mailing list