On Sunday 09 April 2006 18:57, Eric Hawthorne wrote:
> I have a MYSQL InnoDB database.
>=20
> I have a table called Voter with an important BoolCol attribute
> called hasVoted, and another table called Ballot that records
> the voter's choices.
>=20
> I go:
>=20
> voter =3D Voter.get(someId)
> ...
> hub.begin() <-- supposed to start a transaction
>=20
> ballot =3D Ballot(district.id, encryptedAnswers)
> voter.hasVoted =3D True
>=20
> hub.commit()
> hub.end()
>=20
> 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=
ass
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.
=2D-=20
David Faure -- faure@..., dfaure@...
KDE/KOffice developer, Qt consultancy projects
Klar=E4lvdalens Datakonsult AB, Platform-independent software solutions
|