prepared DB function.