Sunday, August 19, 2007

Ruby Database .... close ruby CDB

I've always want a plain simple ruby database. I've been searching for a lightweight solution to this "desire" I won't even call it a need.

I tried ruby-cdb
http://raa.ruby-lang.org/project/cdb/

basically its a ruby wrapper for access to the "constant Database"
-fast reads
-big data
-good writes

I currently have an error when I try to run it, but I think it was a permissions problem on my linux machine.

undefined method `create' for CDB:Class

Any ideas?

Example Code:

require 'cdb'

CDB.create('cdb', 'tmp', 0600) do |data|
data['eins'] = 'ichi'
data['zwei'] = 'ni'
data['drei'] = 'san'
data['vier'] = 'yon'
end

print CDB.dump('cdb'), "\n"


CDB.update('cdb', 'tmp') do |read, write|
write['one'] = read['eins']
write['two'] = read['zwei']
write['three'] = read['drei']
write['four'] = read['vier']
end

No comments: