Fix database creation with Postgres

* Database.py : fillDefaultData()

PostgreSQL has a rather annoying (mis)feature when dealing with boolean
data types: raw 1/0 input as integer is not automatically cast to
boolean values. Instead, one must use one of several other ways of
signifying true/false.
http://www.postgresql.org/docs/8.4/static/datatype-boolean.html
documents the available and understood formatting.

Fix by special-casing PostgreSQL and making all boolean values fed as
strings, '1' for true and '0' for false.
This commit is contained in:
Mika Bostrom 2009-09-19 11:44:06 +03:00
parent 84dc9652df
commit e54c45b7d1

View File

@ -1014,6 +1014,8 @@ class Database:
c.execute("INSERT INTO Sites (name,currency) VALUES ('PartyPoker', 'USD')")
if self.backend == self.SQLITE:
c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);")
elif self.backend == self.PGSQL:
c.execute("insert into TourneyTypes values (0,1,0,0,0,'0','0',null,'0','0','0');")
else:
c.execute("insert into TourneyTypes values (0,1,0,0,0,0,0,null,0,0,0);")