diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-08-15 20:03:34 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-08-15 20:03:34 +0000 |
| commit | c727729183bdf773df9b7ebe725fb7a57e7508a2 (patch) | |
| tree | 18a3bc9b28e0e9f5783d1c908f5f676392ed392f /django | |
| parent | 7cfddb3c43ba5b006b0e0082dfc77abeb846a15a (diff) | |
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
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/meta/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
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), |
