update script aktuell

This commit is contained in:
Enno Rehling 2002-01-02 13:29:22 +00:00
parent 4e2566c933
commit 6f1a253ee3
1 changed files with 3 additions and 3 deletions

View File

@ -7,12 +7,12 @@ import sys
dbname=sys.argv[1] dbname=sys.argv[1]
file=sys.argv[2] file=sys.argv[2]
game=int(sys.argv[3]) game=int(sys.argv[3])
infile=open('update.log', 'r') infile=open(file, 'r')
db=MySQLdb.connect(db=dbname) db=MySQLdb.connect(db=dbname)
cursor=db.cursor() cursor=db.cursor()
matchrenum=re.compile( matchrenum=re.compile(
r"""renum\s(.*)\s(.*)""", r"""renum\s([^\s]+)\s(.*)\n""",
re.IGNORECASE | re.DOTALL | re.VERBOSE) re.IGNORECASE | re.DOTALL | re.VERBOSE)
matchdropout=re.compile( matchdropout=re.compile(
@ -24,6 +24,6 @@ for line in infile.readlines():
if match!=None: if match!=None:
fold=match.group(1) fold=match.group(1)
fnew=match.group(2) fnew=match.group(2)
i=cursor.execute("update subscriptions set faction='"+fnew+"' where game="+str(game)+" and faction='"+fold+"') i=cursor.execute("update subscriptions set faction='"+fnew+"' where game="+str(game)+" and faction='"+fold+"'")
if i!=1: if i!=1:
print "could not renum faction "+fold+" to new id "+fnew print "could not renum faction "+fold+" to new id "+fnew