Fix initial run with postgres
Simplify error check, so that regardless of how the table name is mangled, we now catch just the meaningful part. When trying to obtain the lock, make sure that there is no transaction block open (which tends to happen on error-paths); flush the database connection before requesting exclusive lock.
This commit is contained in:
parent
d3373add8b
commit
14dc35ef81
|
@ -589,11 +589,12 @@ class fpdb_db:
|
|||
return(1)
|
||||
elif self.backend == self.PGSQL:
|
||||
try:
|
||||
self.db.commit()
|
||||
self.cursor.execute( "lock table Players in exclusive mode nowait" )
|
||||
#print "... after lock table, status =", self.cursor.statusmessage
|
||||
except:
|
||||
# relation "players" does not exist
|
||||
if str(sys.exc_value).find('relation "Players" does not exist') >= 0:
|
||||
if str(sys.exc_value).find('does not exist') >= 0:
|
||||
return(2)
|
||||
print "Error! failed to obtain global lock. Close all programs accessing " \
|
||||
+ "database (including fpdb) and try again (%s)." \
|
||||
|
|
Loading…
Reference in New Issue
Block a user