How much of this file has been copied from dbi.c? I tend to think that it's a good idea to have two different plugins (it would have also been an option to include notification support to the dbi plugin) but common code should be moved to, for example, some util_dbi.c module.