I figured this one out.  Auto commit on the database is not on.  I’m assuming the Zope or Python mysql driver or a database driver somewhere has set the default of auto commit to off.   

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Johnson
Sent: Tuesday, May 09, 2006 11:40 AM
To: 'user-list zope'
Subject: [Zope3-Users] SQL Database Bug?

 

The following code seems to be buggy somehow, but I’m not clear how or why.  It seems for some reason that the first SQL “insert” query I run does not get processed, while the second one does.  I’ve tried numerous variations on this with no success.  I’ve done inserts before without problems. 

 

# The transaction ID “dj3” already exists in all cases, so both queryForResults calls should

# throw an exception, however only the second, third, fourth do.

query = "insert into transactions (transid) values ('dj3')"

print query

queryForResults(self.db,query)

queryForResults(self.db,query)

queryForResults(self.db,query)

queryForResults(self.db,query)

 

Generates:

DatabaseException: (1062, "Duplicate entry 'dj3' for key 1")

 

 

--

David Johnson

[EMAIL PROTECTED]

201 Main Street Suite 1320

Fort Worth, TX 76102

(877) 572-8324 x2200

 

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to