On Sunday 09 April 2006 18:57, Eric Hawthorne wrote:
> I have a MYSQL InnoDB database.
> I have a table called Voter with an important BoolCol attribute
> called hasVoted, and another table called Ballot that records
> the voter's choices.
> I go:
> voter =3D Voter.get(someId)
> hub.begin() <-- supposed to start a transaction
> ballot =3D Ballot(district.id, encryptedAnswers)
> voter.hasVoted =3D True
> So how could it happen that the database examined after this
> shows that the ballot row has been created but that the
> voter.has_voted has value 0 (i.e. False). That's what
> happened. This is very bad.
Did you disable autocommit in the connection?
Also, I don't know the hub api, but when using t=3Dtransaction() I had to p=
the transaction to the calls, e.g. ballot =3D Ballot(..., connection =3D t).
Setting debug and debugOutput to True in the connection object is a=20
good way to see the actual SQL being generated, and whether it's being
issued inside the transaction or in another connection.
David Faure -- faure@..., dfaure@...
KDE/KOffice developer, Qt consultancy projects
Klar=E4lvdalens Datakonsult AB, Platform-independent software solutions