db: Use variable functions/callbacks instead of call_user_func()