Changed meta.py save() code from [507] to work under sqlite. All tests now pass in all 3 database backends.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@510 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7cfddb3c43
commit
c727729183
|
@ -735,7 +735,7 @@ def method_save(opts, self):
|
|||
# Determine whether a record with the primary key already exists.
|
||||
cursor.execute("SELECT 1 FROM %s WHERE %s=%%s LIMIT 1" % (opts.db_table, opts.pk.name), [pk_val])
|
||||
# If it does already exist, do an UPDATE.
|
||||
if cursor.rowcount > 0:
|
||||
if cursor.fetchone():
|
||||
db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.name), False)) for f in non_pks]
|
||||
cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % (opts.db_table,
|
||||
','.join(['%s=%%s' % f.name for f in non_pks]), opts.pk.name),
|
||||
|
|
Loading…
Reference in New Issue