You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by le...@apache.org on 2005/05/01 13:54:12 UTC
svn commit: r165483 - /gump/trunk/python/gump/util/mysql.py
Author: leosimons
Date: Sun May 1 04:54:10 2005
New Revision: 165483
URL: http://svn.apache.org/viewcvs?rev=165483&view=rev
Log:
The selection code in mysql.py is a little naive. In this case, if there is nothing in the database yet (which in general, is valid), the row = ... line fails with
SQL Error on [SELECT * FROM gump_public.gump_workspace_stats WHERE workspace_name='vmgump-public'] : tuple index out of range
Traceback (most recent call last):
File /x1/gump/public/gump/python/gump/util/mysql.py, line 147, in select
row = cursor.fetchall()[0] # Ought be only one...
or something similar. Checking to make sure some rows are affected makes sense :).
Modified:
gump/trunk/python/gump/util/mysql.py
Modified: gump/trunk/python/gump/util/mysql.py
URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/util/mysql.py?rev=165483&r1=165482&r2=165483&view=diff
==============================================================================
--- gump/trunk/python/gump/util/mysql.py (original)
+++ gump/trunk/python/gump/util/mysql.py Sun May 1 04:54:10 2005
@@ -144,7 +144,8 @@
affected=cursor.execute(statement)
log.debug('SQL affected: ' + `affected`)
- row = cursor.fetchall()[0] # Ought be only one...
+ if affected > 0: # might be nothing in db yet
+ row = cursor.fetchall()[0] # Ought be only one...
# Extract values
for column in columns: