def get_db_id(val, db, m, table, kmap, rid_map, allow_case_change, case_changes, val_map, is_authors=False):
 kval = kmap(val)
 item_id = rid_map.get(kval, None)
 if (item_id is None):
  if is_authors:
   aus = author_to_author_sort(val)
   db.execute(u'INSERT INTO authors(name,sort) VALUES (?,?)', (val.replace(u',', u'|'), aus))
  else:
   db.execute((u'INSERT INTO %s(%s) VALUES (?)' % (m[u'table'], m[u'column'])), (val,))
  item_id = rid_map[kval] = db.last_insert_rowid()
  table.id_map[item_id] = val
  table.col_book_map[item_id] = set()
  if is_authors:
   table.asort_map[item_id] = aus
   table.alink_map[item_id] = u''
 elif (allow_case_change and (val != table.id_map[item_id])):
  case_changes[item_id] = val
 val_map[val] = item_id

def get_db_id ( val , db , m , table , kmap , rid_map , allow_case_change , case_changes , val_map , is_authors = False ) : kval = kmap ( val ) item_id = rid_map . get ( kval , None ) if ( item_id is None ) : if is_authors : aus = author_to_author_sort ( val ) db . execute ( u'INSERT INTO authors(name,sort) VALUES (?,?)' , ( val . replace ( u',' , u'|' ) , aus ) ) else : db . execute ( ( u'INSERT INTO %s(%s) VALUES (?)' % ( m [ u'table' ] , m [ u'column' ] ) ) , ( val , ) ) item_id = rid_map [ kval ] = db . last_insert_rowid ( ) table . id_map [ item_id ] = val table . col_book_map [ item_id ] = set ( ) if is_authors : table . asort_map [ item_id ] = aus table . alink_map [ item_id ] = u'' elif ( allow_case_change and ( val != table . id_map [ item_id ] ) ) : case_changes [ item_id ] = val val_map [ val ] = item_id
get the db id for the value val .