from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
from sqlalchemy.dialects.mysql.base import BIT, MySQLDialect, MySQLExecutionContext
-class _JDBCBit(BIT):
+class _ZxJDBCBit(BIT):
def result_processor(self, dialect):
"""Converts boolean or byte arrays from MySQL Connector/J to longs."""
def process(value):
return process
-class MySQL_jdbcExecutionContext(MySQLExecutionContext):
+class MySQL_zxjdbcExecutionContext(MySQLExecutionContext):
def get_lastrowid(self):
cursor = self.create_cursor()
cursor.execute("SELECT LAST_INSERT_ID()")
return lastrowid
-class MySQL_jdbc(ZxJDBCConnector, MySQLDialect):
- execution_ctx_cls = MySQL_jdbcExecutionContext
-
+class MySQL_zxjdbc(ZxJDBCConnector, MySQLDialect):
jdbc_db_name = 'mysql'
jdbc_driver_name = 'com.mysql.jdbc.Driver'
+ execution_ctx_cls = MySQL_zxjdbcExecutionContext
+
colspecs = util.update_copy(
MySQLDialect.colspecs,
{
sqltypes.Time: sqltypes.Time,
- BIT: _JDBCBit
+ BIT: _ZxJDBCBit
}
)
version.append(n)
return tuple(version)
-dialect = MySQL_jdbc
+dialect = MySQL_zxjdbc
SQLException = zxJDBC = None
-class _JDBCDate(sqltypes.Date):
+class _ZxJDBCDate(sqltypes.Date):
def result_processor(self, dialect):
def process(value):
return process
-class _JDBCNumeric(sqltypes.Numeric):
+class _ZxJDBCNumeric(sqltypes.Numeric):
def result_processor(self, dialect):
if self.asdecimal:
return process
-class Oracle_jdbcCompiler(OracleCompiler):
+class Oracle_zxjdbcCompiler(OracleCompiler):
def returning_clause(self, stmt, returning_cols):
columnlist = list(expression._select_iterables(returning_cols))
return 'RETURNING ' + ', '.join(columns) + " INTO " + ", ".join(binds)
-class Oracle_jdbcExecutionContext(default.DefaultExecutionContext):
+class Oracle_zxjdbcExecutionContext(default.DefaultExecutionContext):
def pre_exec(self):
if hasattr(self.compiled, 'returning_parameters'):
return self.type == other.type
return NotImplemented
+ def __ne__(self, other):
+ if isinstance(other, ReturningParam):
+ return self.type != other.type
+ return NotImplemented
+
def __repr__(self):
kls = self.__class__
return '<%s.%s object at 0x%x type=%s>' % (kls.__module__, kls.__name__, id(self),
self.type)
-class Oracle_jdbc(ZxJDBCConnector, OracleDialect):
- statement_compiler = Oracle_jdbcCompiler
- execution_ctx_cls = Oracle_jdbcExecutionContext
+class Oracle_zxjdbc(ZxJDBCConnector, OracleDialect):
jdbc_db_name = 'oracle'
jdbc_driver_name = 'oracle.jdbc.OracleDriver'
+ statement_compiler = Oracle_zxjdbcCompiler
+ execution_ctx_cls = Oracle_zxjdbcExecutionContext
+
colspecs = util.update_copy(
OracleDialect.colspecs,
{
- sqltypes.Date : _JDBCDate,
- sqltypes.Numeric: _JDBCNumeric
+ sqltypes.Date : _ZxJDBCDate,
+ sqltypes.Numeric: _ZxJDBCNumeric
}
)
def __init__(self, *args, **kwargs):
- super(Oracle_jdbc, self).__init__(*args, **kwargs)
+ super(Oracle_zxjdbc, self).__init__(*args, **kwargs)
global SQLException, zxJDBC
from java.sql import SQLException
from com.ziclix.python.sql import zxJDBC
self.DataHandler = OracleReturningDataHandler
def initialize(self, connection):
- super(Oracle_jdbc, self).initialize(connection)
+ super(Oracle_zxjdbc, self).initialize(connection)
self.implicit_returning = connection.connection.driverversion >= '10.2'
def _create_jdbc_url(self, url):
version = re.search(r'Release ([\d\.]+)', connection.connection.dbversion).group(1)
return tuple(int(x) for x in version.split('.'))
-dialect = Oracle_jdbc
+dialect = Oracle_zxjdbc