From c727729183bdf773df9b7ebe725fb7a57e7508a2 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 15 Aug 2005 20:03:34 +0000 Subject: [PATCH] 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 --- django/core/meta/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/core/meta/__init__.py b/django/core/meta/__init__.py index d28cb04f88..e50870d9c7 100644 --- a/django/core/meta/__init__.py +++ b/django/core/meta/__init__.py @@ -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),