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.
# 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)
"""
-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
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:
class Oracle_cx_oracle(OracleDialect):
execution_ctx_cls = Oracle_cx_oracleExecutionContext
+ statement_compiler = Oracle_cx_oracleCompiler
driver = "cx_oracle"
colspecs = colspecs
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)