]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
move cx_oracle's bind param quoting out of base and its do_release_savepoint
authorPhilip Jenvey <pjenvey@underboss.org>
Fri, 31 Jul 2009 05:28:44 +0000 (05:28 +0000)
committerPhilip Jenvey <pjenvey@underboss.org>
Fri, 31 Jul 2009 05:28:44 +0000 (05:28 +0000)
into base

lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/dialects/oracle/cx_oracle.py

index 09d18cb19b5905ba51cd782230c56b336866ec4f..bd08e62d423dd36e5bf29344a96ca6a06538ce29 100644 (file)
@@ -258,16 +258,6 @@ class OracleCompiler(compiler.SQLCompiler):
         else:
             return ""
         
-    def bindparam_string(self, name):
-        # TODO: its not clear how much of bind parameter quoting is "Oracle"
-        # and how much is "cx_Oracle".
-        if self.preparer._bindparam_requires_quotes(name):
-            quoted_name = '"%s"' % name
-            self._quoted_bind_names[name] = quoted_name
-            return compiler.SQLCompiler.bindparam_string(self, quoted_name)
-        else:
-            return compiler.SQLCompiler.bindparam_string(self, name)
-
     def default_from(self):
         """Called when a ``SELECT`` statement has no froms, and no ``FROM`` clause is to be appended.
 
@@ -509,6 +499,10 @@ class OracleDialect(default.DefaultDialect):
 #        self.implicit_returning = self.server_version_info > (10, ) and \
 #                                        self.__dict__.get('implicit_returning', True)
 
+    def do_release_savepoint(self, connection, name):
+        # Oracle does not support RELEASE SAVEPOINT
+        pass
+
     def has_table(self, connection, table_name, schema=None):
         if not schema:
             schema = self.get_default_schema_name(connection)
index 65395467e49cc7994cf012cfe162b2f14019b57c..d8a0c445a42e08ee1981313e02b358904a6c6945 100644 (file)
@@ -63,7 +63,7 @@ working successfully but this should be regarded as an experimental feature.
 
 """
 
-from sqlalchemy.dialects.oracle.base import OracleDialect, RESERVED_WORDS
+from sqlalchemy.dialects.oracle.base import OracleCompiler, OracleDialect, RESERVED_WORDS
 from sqlalchemy.dialects.oracle import base as oracle
 from sqlalchemy.engine.default import DefaultExecutionContext
 from sqlalchemy.engine import base
@@ -161,9 +161,17 @@ colspecs = {
     oracle.RAW: _OracleRaw,
 }
 
+class Oracle_cx_oracleCompiler(OracleCompiler):
+    def bindparam_string(self, name):
+        if self.preparer._bindparam_requires_quotes(name):
+            quoted_name = '"%s"' % name
+            self._quoted_bind_names[name] = quoted_name
+            return OracleCompiler.bindparam_string(self, quoted_name)
+        else:
+            return OracleCompiler.bindparam_string(self, name)
+
 class Oracle_cx_oracleExecutionContext(DefaultExecutionContext):
     def pre_exec(self):
-        
         quoted_bind_names = getattr(self.compiled, '_quoted_bind_names', {})
         if quoted_bind_names:
             for param in self.parameters:
@@ -241,6 +249,7 @@ class ReturningResultProxy(base.FullyBufferedResultProxy):
 
 class Oracle_cx_oracle(OracleDialect):
     execution_ctx_cls = Oracle_cx_oracleExecutionContext
+    statement_compiler = Oracle_cx_oracleCompiler
     driver = "cx_oracle"
     colspecs = colspecs
     
@@ -344,10 +353,6 @@ class Oracle_cx_oracle(OracleDialect):
         id = random.randint(0, 2 ** 128)
         return (0x1234, "%032x" % id, "%032x" % 9)
 
-    def do_release_savepoint(self, connection, name):
-        # Oracle does not support RELEASE SAVEPOINT
-        pass
-
     def do_begin_twophase(self, connection, xid):
         connection.connection.begin(*xid)