No subject
Mon Aug 2 21:34:10 CDT 2004
I have a simple binding library which lets you do something like the
following:
class Foo
attr_reader :bar, baz
attr_writer :bar, :baz
end
Persist::bind(Foo, 'foo_table', :bar, :baz)
f = Foo.fetch('pkey_value')
f.bar = 3
f.store
Foo.select('where bar > ?', 2) {|foo_obj|
p foo_obj
}
It handles about 80% of the database queries I use in a moderately
complex (~20kloc)
business application, with the remaining bits done in basic DBI calls.
I've also been experimenting with a thread-safe LRU cache for objects,
so that at least multiple concurrent reads of a database-bound data
object don't have to make a full round trip to the database for each
instance.
Right now, it's not really package as a standalone library, but I'd be
happy to go back over the code, clean it up, and either post it here
or on RAA for others to try out.
Phil
-------------------------------------------------------------------------
To find out more about Ruby, check out:
http://www.ruby-lang.org
To subscribe to the PDX.rb mailing list, send an email to:
pdxruby-subscribe at kohalabs.com
More information about the Pdx-pm-list
mailing list