Move logic from get_db_prep_value() to get_prep_value()

As it's non-database specific.