View Single Post
Old 07-07-2010, 10:58 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,461
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
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)
chaley is offline   Reply With Quote