Merge branch 'master' of git://git.assembla.com/fpdb.git

This commit is contained in:
Gerko de Roo 2010-08-01 13:29:41 +02:00
commit 2545e29eb2
2 changed files with 7 additions and 3 deletions

View File

@ -951,6 +951,7 @@ class Database:
# hmmm, tested by commenting out rollback in grapher. lock seems to work but # hmmm, tested by commenting out rollback in grapher. lock seems to work but
# then drop still hangs :-( does work in some tests though?? # then drop still hangs :-( does work in some tests though??
# will leave code here for now pending further tests/enhancement ... # will leave code here for now pending further tests/enhancement ...
c.execute("BEGIN TRANSACTION")
c.execute( "lock table %s in exclusive mode nowait" % (fk['fktab'],) ) c.execute( "lock table %s in exclusive mode nowait" % (fk['fktab'],) )
#print "after lock, status:", c.statusmessage #print "after lock, status:", c.statusmessage
#print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol']) #print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol'])
@ -961,6 +962,7 @@ class Database:
if "does not exist" not in str(sys.exc_value): if "does not exist" not in str(sys.exc_value):
print "warning: drop pg fk %s_%s_fkey failed: %s, continuing ..." \ print "warning: drop pg fk %s_%s_fkey failed: %s, continuing ..." \
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') ) % (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
c.execute("END TRANSACTION")
except: except:
print "warning: constraint %s_%s_fkey not dropped: %s, continuing ..." \ print "warning: constraint %s_%s_fkey not dropped: %s, continuing ..." \
% (fk['fktab'],fk['fkcol'], str(sys.exc_value).rstrip('\n')) % (fk['fktab'],fk['fkcol'], str(sys.exc_value).rstrip('\n'))
@ -984,6 +986,7 @@ class Database:
print "dropping pg index ", idx['tab'], idx['col'] print "dropping pg index ", idx['tab'], idx['col']
try: try:
# try to lock table to see if index drop will work: # try to lock table to see if index drop will work:
c.execute("BEGIN TRANSACTION")
c.execute( "lock table %s in exclusive mode nowait" % (idx['tab'],) ) c.execute( "lock table %s in exclusive mode nowait" % (idx['tab'],) )
#print "after lock, status:", c.statusmessage #print "after lock, status:", c.statusmessage
try: try:
@ -995,6 +998,7 @@ class Database:
if "does not exist" not in str(sys.exc_value): if "does not exist" not in str(sys.exc_value):
print "warning: drop index %s_%s_idx failed: %s, continuing ..." \ print "warning: drop index %s_%s_idx failed: %s, continuing ..." \
% (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n')) % (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n'))
c.execute("END TRANSACTION")
except: except:
print "warning: index %s_%s_idx not dropped %s, continuing ..." \ print "warning: index %s_%s_idx not dropped %s, continuing ..." \
% (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n')) % (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n'))

View File

@ -146,8 +146,8 @@ class Sql:
id BIGSERIAL, PRIMARY KEY (id), id BIGSERIAL, PRIMARY KEY (id),
tourneysPlayerId INT NOT NULL, FOREIGN KEY (tourneysPlayerId) REFERENCES TourneysPlayers(id), tourneysPlayerId INT NOT NULL, FOREIGN KEY (tourneysPlayerId) REFERENCES TourneysPlayers(id),
playerId INT NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id), playerId INT NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
buyInPercentage FLOAT UNSIGNED NOT NULL, buyInPercentage FLOAT NOT NULL,
payOffPercentage FLOAT UNSIGNED NOT NULL)""" payOffPercentage FLOAT NOT NULL)"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['createBackingsTable'] = """CREATE TABLE Backings ( self.query['createBackingsTable'] = """CREATE TABLE Backings (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
@ -3275,7 +3275,7 @@ class Sql:
,sum(CAST(foldToOtherRaisedStreet2 as integer)) ,sum(CAST(foldToOtherRaisedStreet2 as integer))
,sum(CAST(foldToOtherRaisedStreet3 as integer)) ,sum(CAST(foldToOtherRaisedStreet3 as integer))
,sum(CAST(foldToOtherRaisedStreet4 as integer)) ,sum(CAST(foldToOtherRaisedStreet4 as integer))
,sum(CAST(raisedFirstInChance as integer)) ,sum(CAST(raiseFirstInChance as integer))
,sum(CAST(raisedFirstIn as integer)) ,sum(CAST(raisedFirstIn as integer))
,sum(CAST(foldBbToStealChance as integer)) ,sum(CAST(foldBbToStealChance as integer))
,sum(CAST(foldedBbToSteal as integer)) ,sum(CAST(foldedBbToSteal as integer))