[odb_backend] implement foreach callback. slightly tricky