summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2006-11-04 18:38:39 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2006-11-04 18:38:39 +0000
commitf70998c1b847940076a425df2f4503e432c0293d (patch)
tree501980a6fad1383767be1ae99a49b18c68d61ef3
parent5e8d740caaa35a05711d15a37b166faddb255b43 (diff)
[boulder-oracle-sprint] Cleaned up oracle backend somewhat:
* query format style conversion should now work * removed hardcoded "print" statements * uppercase quoted identifiers (which Oracle seems to require) git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@3967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/backends/oracle/base.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 5924e02e6c..bd93902994 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -69,30 +69,30 @@ class FormatStylePlaceholderCursor(Database.Cursor):
you'll need to use "%%s".
"""
def execute(self, query, params=None):
- if params is None: params = []
- query = self.convert_arguments(query, len(params))
+ if params is None:
+ params = []
+ args = [(':arg%s' % i) for i in range(num_params)]
+ query = query % tuple(args)
+
# cx can not execute the query with the closing ';'
- if query.endswith(';') :
+ if query.endswith(';'):
query = query[0:len(query)-1]
- print query
- print params
- return Database.Cursor.execute(self, query, params)
+ return Database.Cursor.execute(self, query, params)
def executemany(self, query, params=None):
if params is None: params = []
query = self.convert_arguments(query, len(params[0]))
# cx can not execute the query with the closing ';'
if query.endswith(';') :
- query = query[0:len(query)-1]
+ query = query[0:len(query)-1]
return Database.Cursor.executemany(self, query, params)
- def convert_arguments(self, query, num_params):
- # replace occurances of "%s" with ":arg" - Oracle requires colons for parameter placeholders.
- args = [':arg' for i in range(num_params)]
- return query % tuple(args)
-
def quote_name(name):
- return name
+ if name.startswith('"') and name.endswith('"'):
+ return name # Quoting once is enough.
+
+ # Oracle requires that quoted names be uppercase.
+ return '"%s"' % name.upper()
dictfetchone = util.dictfetchone
dictfetchmany = util.dictfetchmany