complete the db operation funcs' code