view py/cleandb.py @ 17:7f7b3da664d6

Begin adding arogue5 support to the recorder script. rlgalldb.py's arogue5 object is a nonfunctional stub, but at least it doesn't crash and the other games still work.
author John "Elwin" Edwards <elwin@sdf.org>
date Sun, 16 Sep 2012 20:44:22 -0700
parents 5ba2123d2c20
children e8f3b7994d88
line wrap: on
line source

#!/usr/bin/python
# cleandb.py: empty the database in an orderly fashion

import rlgalldb as rlgall
import psycopg2

dbconn = psycopg2.connect("dbname=rlg")
dbcur = dbconn.cursor()

dbcur.execute("UPDATE games SET offbytes = %s", [0])

for game in rlgall.gamelist:
  dbcur.execute("DELETE FROM " + game.uname + ";")

dbcur.execute("DELETE FROM players;")
dbconn.commit()

dbcur.close()
dbconn.close()
exit()