[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

SDBM troubles

Tassilo Horn

5/1/2006 9:23:00 PM

Hi all,

I wrote a small translation application which uses the dictionary you
can freely get from www.dict.cc. This app stores the entries in GDBM
database files:

keyword => multiple_translations_stringified

The databases are really large (~20MB per dict file). The whole
application really works good, except the initial import into the
database files takes quite a lot time, but that's ok for me.

And here's the problem:
=======================

I want to get rid of the dependency to GDBM and use SDBM as drop in
replacement, because the PickAxe says, that this comes with
ruby. Changing the code was easy, but when I try to import my data
structure into the dict, I get this error on some entries:

/usr/local/bin/rdictccserver:206:in `[]=': sdbm_store failed (SDBMError)
from /usr/local/bin/rdictccserver:206:in `write_database'
from /usr/local/bin/rdictccserver:204:in `write_database'
from /usr/local/bin/rdictccserver:198:in `write_database'
from /usr/local/bin/rdictccserver:181:in `initialize_database'
from /usr/local/bin/rdictccserver:125:in `initialize'
from /usr/local/bin/rdictccserver:296
from /usr/lib/ruby/1.8/optparse.rb:1313:in `order!'
from /usr/lib/ruby/1.8/optparse.rb:1271:in `order!'
from /usr/lib/ruby/1.8/optparse.rb:1351:in `permute!'
from /usr/lib/ruby/1.8/optparse.rb:1378:in `parse!'
from /usr/lib/ruby/1.8/optparse.rb:1371:in `parse'
from /usr/local/bin/rdictccserver:313

In investigated a bit and it seems that the cause to this error is that
the value-strings are too big. If I rescue and ignore the SDBMError and
store the value sizes I get this result:

Max working length = 998
Min failing length = 1008

Can it really be that SDBM values cannot be larger than 1000 chars?

Kind regards,
Tassilo
--
My opinions may have changed, but not the fact that I am right.