each loop on Berkeley DB Databases : dbm « Database « Ruby






each loop on Berkeley DB Databases


require 'bdb'

db = BDB::Btree.create('e.db', nil, BDB::CREATE)
db['earth'] = 'M'
db['water'] = 'A'
db['air'] = 's'
db['fire'] = 'P'

db.each { |k,v| puts k }
puts db['water']
db.close

 








Related examples in the same category

1.Using Berkeley DB Databases
2.Save and retrieve data from Berkeley DB Databases
3.Save and retrieve data from DBM