Ugh, why would autocommit be set to 1 in the site but 0 in the shell??? --Brandon
On 2007-05-01 (Tue) at 18:13:55 -0500, Brandon Low wrote: > > So initially, when you said that, I thought to myself, "Of course, how > could I be so dumb" but then I did: > > >>> from django.db import connection; > >>> cursor = connection.cursor() > >>> cursor.execute("select @@autocommit;") > 1L > >>> row=cursor.fetchone() > >>> row > (0L,) > > at the shell and it looks like autocommit is set to 0. There isn't some > kind of per-table autocommit setting that I could still be missing, is > there? > > Thanks again, > > Brandon > > On 2007-05-01 (Tue) at 17:32:29 -0400, Andy Dustman wrote: > > > > On 5/1/07, Brandon Low <[EMAIL PROTECTED]> wrote: > > > > > > my model is very simple: > > > > > > class Referrer(models.Model): > > > url = models.CharField(maxlength=255, unique=True) > > > > > > here is the relevent view code: > > > > > > referrer = request.META.get('HTTP_REFERER','-') > > > r, r_new = Referrer.objects.get_or_create(url=referrer) > > > > The only other option I can think of is that you are using a MySQL > > storage engine that doesn't support transactions (or running in > > autocommit mode) and so you are getting a sort of race condition > > where two requests come in about the same time, both do a SELECT and > > see there is no matching row, and one gets it INSERTed first. Normally > > I would expect to see the IntegrityError at the commit phase. > > -- > > Patriotism means to stand by the country. It does > > not mean to stand by the president. -- T. Roosevelt > > > > This message has been scanned for memes and > > dangerous content by MindScanner, and is > > believed to be unclean. > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---