':type session: sqlalchemy.orm.Session
:rtype: list[ChatIdEntry]'

def _get_chat_ids_n_update_db(self, session):

    usernames = self._usernames[:]
    fullnames = self._fullnames[:]
    groups = self._groups[:]
    (chat_ids, has_new_chat_ids) = self._get_chat_ids(session, usernames, fullnames, groups)
    self.log.debug(u'chat_ids=%s', chat_ids)
    if (not chat_ids):
        raise PluginError(u'no    chat    id    found,    try    manually    sending    the    bot    any    message    to    initialize    the    chat')
    else:
        if usernames:
            self.log.warning(u'no    chat    id    found    for    usernames:    %s', usernames)
        if fullnames:
            self.log.warning(u'no    chat    id    found    for    fullnames:    %s', fullnames)
        if groups:
            self.log.warning(u'no    chat    id    found    for    groups:    %s', groups)
        if has_new_chat_ids:
            self._update_db(session, chat_ids)
    return chat_ids
