Christopher Browne writes:
 > This is a true fact, and suggests that GnuCash could perhaps be a candidate
 > for use with CDB <ftp://koobera.math.uic.edu/www/cdb.html>, a highly robust
 > hash table scheme that provides fast lookups *but only one value per key.*

And fast, atomic updates.  On a decent server, I've updated a
two-hundred-megabyte CDB in under 90 seconds.  "updated" means that I
removed a few thousand records.  While the update was occurring, the
database was still accessible for probes.

#!/usr/bin/perl
# given a list of email addresses, remove them from our database.

# put all of stdin into a hash.
while(<>) { chomp; $in{$_} = ""; }

open(DBO, "|cdbmake data/db.cdb data/db.$$") or die "cdbmake: $!\n";
open(DBI, "cdbdump <data/db.cdb|") or die "cdbdump: $!\n";
while(<DBI>) {
  next if (($length) = m/^\+(\d+),\d+:/) && exists($in{substr($', 0, $length)});
  print DBO;
}
close(DBI) or die "cdbdump close: $!\n";
close(DBO) or die "cdbmake close: $!\n";

-- 
-russ nelson <[EMAIL PROTECTED]>  http://russnelson.com
Crynwr sells support for free software  | PGPok | Government schools are so
521 Pleasant Valley Rd. | +1 315 268 1925 voice | bad that any rank amateur
Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   | can outdo them. Homeschool!

--
Gnucash Developer's List 
To unsubscribe send empty email to: [EMAIL PROTECTED]

Reply via email to