'Insert(table, datadict) - Insert a new row into the table
using the keys+values from rowdict as the column values.'

def Insert(self, table, rowdict):

    txn = None
    try:
        if (not getattr(self.db, 'has_key')(_columns_key(table))):
            raise TableDBError, 'unknown    table'
        if (not (table in self.__tablecolumns)):
            self.__load_column_info(table)
        for column in rowdict.keys():
            if (not self.__tablecolumns[table].count(column)):
                raise TableDBError, ('unknown    column:    %r' % (column,))
        txn = self.env.txn_begin()
        rowid = self.__new_rowid(table, txn=txn)
        for (column, dataitem) in rowdict.items():
            self.db.put(_data_key(table, column, rowid), dataitem, txn=txn)
        txn.commit()
        txn = None
    except db.DBError as dberror:
        info = sys.exc_info()
        if txn:
            txn.abort()
            self.db.delete(_rowid_key(table, rowid))
        if (sys.version_info < (2, 6)):
            raise TableDBError, dberror[1], info[2]
        else:
            raise TableDBError, dberror.args[1], info[2]
