'Add a ban to the database.
Parameters
jail : Jail
Jail in which the ban has occurred.
ticket : BanTicket
Ticket of the ban to be added.'

@commitandrollback
def addBan(self, cur, jail, ticket):

    ip = str(ticket.getIP())
    try:
        del self._bansMergedCache[(ip, jail)]
    except KeyError:
        pass
    try:
        del self._bansMergedCache[(ip, None)]
    except KeyError:
        pass
    cur.execute('INSERT    INTO    bans(jail,    ip,    timeofban,    bantime,    bancount,    data)    VALUES(?,    ?,    ?,    ?,    ?,    ?)', (jail.name, ip, int(round(ticket.getTime())), ticket.getBanTime(jail.actions.getBanTime()), ticket.getBanCount(), ticket.getData()))
    cur.execute('INSERT    OR    REPLACE    INTO    bips(ip,    jail,    timeofban,    bantime,    bancount,    data)    VALUES(?,    ?,    ?,    ?,    ?,    ?)', (ip, jail.name, int(round(ticket.getTime())), ticket.getBanTime(jail.actions.getBanTime()), ticket.getBanCount(), ticket.getData()))
