1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

[boulder-oracle-sprint] Applied Oracle patch

git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@3966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Boulder Sprinters
2006-11-04 18:07:10 +00:00
parent 98fb26101c
commit 5e8d740caa
7 changed files with 176 additions and 30 deletions

View File

@@ -171,8 +171,9 @@ class Model(object):
record_exists = True
if pk_set:
# Determine whether a record with the primary key already exists.
cursor.execute("SELECT 1 FROM %s WHERE %s=%%s LIMIT 1" % \
(backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column)), [pk_val])
lim = settings.DATABASE_ENGINE != 'oracle' and ' LIMIT 1' or ''
cursor.execute("SELECT 1 FROM %s WHERE %s=%%s %s" % \
(backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column), lim), [pk_val])
# If it does already exist, do an UPDATE.
if cursor.fetchone():
db_values = [f.get_db_prep_save(f.pre_save(self, False)) for f in non_pks]