Actually, it probably is a few minutes.
Look at the new class library.field_metadata, available as db.field_metadata. This a dict, keyed by the attribute name. The data fetched using the key has everything needed, including the datatype and its column number for fetching and storing the information.
Something like:
Code:
for key in db.field_metadata:
if db.field_metadata[key]['is_custom']:
col_num = db.field_metadata[key]['col_num']
# now do what is needed, according to type. rec_index is used
# to get the value you are working with. something like
from_record_value = db.get_custom(from_id, num=col_num)
# process ...
set_custom(to_id, val, num=col_num)