modified for mysql
modified for bdb and asyncdb