dbm library

P

PWR

I am using Ruby 1.8.2 on Windows and am wanting to use the dbm library
but cannot seem to find it anywhere. Can anyone please tell me where I
can find this package?
 
A

ara.t.howard

I am using Ruby 1.8.2 on Windows and am wanting to use the dbm library
but cannot seem to find it anywhere. Can anyone please tell me where I
can find this package?

it comes with ruby.

harp:~ > ruby -r dbm -e' p DBM '
DBM


-a
 
B

Bill Kelly

From: "PWR said:
Thanks, that's solved it. I am now using SDBM.

Warning, unless something's changed since I last tried SDBM
on Windows a few years ago... It has some severe limitations.

(It wasn't a Ruby problem, Perl uses the same SDBM library and
exhibits the same issues.)

For ex... This test program tries to write a million key/values
to an SDBM store, where the key length is 8 bytes, and the
value ranges from 1..512 bytes:


require 'sdbm'

k = 12345678

SDBM.open("test.dbm") do |dbm|
1000.times {|iter|
1000.times {
dbm[k.to_s] = "v" * (rand(511) + 1)
k += 1
}
print "#{iter} "
}
end


On my system (win xp pro, NTFS) it only makes it to around
40,000 to 50,000 keys before blowing up with:
dbmtest.rb:9:in `[]=': sdbm_store failed (SDBMError)

And the .pag file size has bloated up to 1.7 to 2.1 gigs at
the point it dies.

Anyway, just FYI... if you program needs to store a lot of
key/values, SDBM may not be able to handle it...


Regards,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,216
Messages
2,571,120
Members
47,723
Latest member
Monika9748

Latest Threads

Top