Ticket #5030: aggregateDiff.diff

File aggregateDiff.diff, 957 bytes (added by zigiDev@…, 17 years ago)

Patch

  • base.py

     
    213210        record_exists = True
    214211        if pk_set:
    215212            # Determine whether a record with the primary key already exists.
    216             cursor.execute("SELECT COUNT(*) FROM %s WHERE %s=%%s" % \
     213            cursor.execute("SELECT 1 FROM %s WHERE %s=%%s" % \
    217214                (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column)),
    218215                self._meta.pk.get_db_prep_lookup('exact', pk_val))
    219216            # If it does already exist, do an UPDATE.
    220             if cursor.fetchone()[0] > 0:
     217            if cursor.fetchone():
    221218                db_values = [f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, False)) for f in non_pks]
    222219                if db_values:
    223220                    cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % \
Back to Top