Mercurial > hg > rlgallery-misc
view py/cleandb.py @ 69:c2127bc98694
Update the dgamelaunch compatibility patch.
The patch is now to be applied to dgamelaunch revision 6753fd6e.
Maybe I should maintain my own Git branch. But this project already
uses autotools and npm. I don't need any more software that's amazing
in theory but painful to actually work with.
author | John "Elwin" Edwards |
---|---|
date | Sat, 23 Jan 2016 19:04:17 -0500 |
parents | 25843238434a |
children |
line wrap: on
line source
#!/usr/bin/python3 # cleandb.py: empty the database in an orderly fashion import 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()