summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r--lib/sqlalchemy/databases/maxdb.py31
-rw-r--r--lib/sqlalchemy/databases/oracle.py13
-rw-r--r--lib/sqlalchemy/databases/sybase.py7
3 files changed, 21 insertions, 30 deletions
diff --git a/lib/sqlalchemy/databases/maxdb.py b/lib/sqlalchemy/databases/maxdb.py
index 09cc9f0b6..3ca1bd61c 100644
--- a/lib/sqlalchemy/databases/maxdb.py
+++ b/lib/sqlalchemy/databases/maxdb.py
@@ -480,6 +480,21 @@ class MaxDBDialect(default.DefaultDialect):
super(MaxDBDialect, self).__init__(**kw)
self._raise_known = _raise_known_sql_errors
+ if self.dbapi is None:
+ self.dbapi_type_map = {}
+ else:
+ self.dbapi_type_map = {
+ 'Long Binary': MaxBlob(),
+ 'Long byte_t': MaxBlob(),
+ 'Long Unicode': MaxText(),
+ 'Timestamp': MaxTimestamp(),
+ 'Date': MaxDate(),
+ 'Time': MaxTime(),
+ datetime.datetime: MaxTimestamp(),
+ datetime.date: MaxDate(),
+ datetime.time: MaxTime(),
+ }
+
def dbapi(cls):
from sapdb import dbapi as _dbapi
return _dbapi
@@ -498,22 +513,6 @@ class MaxDBDialect(default.DefaultDialect):
else:
return sqltypes.adapt_type(typeobj, colspecs)
- def dbapi_type_map(self):
- if self.dbapi is None:
- return {}
- else:
- return {
- 'Long Binary': MaxBlob(),
- 'Long byte_t': MaxBlob(),
- 'Long Unicode': MaxText(),
- 'Timestamp': MaxTimestamp(),
- 'Date': MaxDate(),
- 'Time': MaxTime(),
- datetime.datetime: MaxTimestamp(),
- datetime.date: MaxDate(),
- datetime.time: MaxTime(),
- }
-
def create_execution_context(self, connection, **kw):
return MaxDBExecutionContext(self, connection, **kw)
diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py
index 71c82bfd8..9c9c54bf6 100644
--- a/lib/sqlalchemy/databases/oracle.py
+++ b/lib/sqlalchemy/databases/oracle.py
@@ -251,24 +251,19 @@ class OracleDialect(default.DefaultDialect):
self.supports_timestamp = self.dbapi is None or hasattr(self.dbapi, 'TIMESTAMP' )
self.auto_setinputsizes = auto_setinputsizes
self.auto_convert_lobs = auto_convert_lobs
-
- if self.dbapi is not None:
- self.ORACLE_BINARY_TYPES = [getattr(self.dbapi, k) for k in ["BFILE", "CLOB", "NCLOB", "BLOB"] if hasattr(self.dbapi, k)]
- else:
+ if self.dbapi is None or not self.auto_convert_lobs or not 'CLOB' in self.dbapi.__dict__:
+ self.dbapi_type_map = {}
self.ORACLE_BINARY_TYPES = []
-
- def dbapi_type_map(self):
- if self.dbapi is None or not self.auto_convert_lobs:
- return {}
else:
# only use this for LOB objects. using it for strings, dates
# etc. leads to a little too much magic, reflection doesn't know if it should
# expect encoded strings or unicodes, etc.
- return {
+ self.dbapi_type_map = {
self.dbapi.CLOB: OracleText(),
self.dbapi.BLOB: OracleBinary(),
self.dbapi.BINARY: OracleRaw(),
}
+ self.ORACLE_BINARY_TYPES = [getattr(self.dbapi, k) for k in ["BFILE", "CLOB", "NCLOB", "BLOB"] if hasattr(self.dbapi, k)]
def dbapi(cls):
import cx_Oracle
diff --git a/lib/sqlalchemy/databases/sybase.py b/lib/sqlalchemy/databases/sybase.py
index 022f54746..87045d192 100644
--- a/lib/sqlalchemy/databases/sybase.py
+++ b/lib/sqlalchemy/databases/sybase.py
@@ -639,8 +639,7 @@ class SybaseSQLDialect_mxodbc(SybaseSQLDialect):
def __init__(self, **params):
super(SybaseSQLDialect_mxodbc, self).__init__(**params)
- def dbapi_type_map(self):
- return {'getdate' : SybaseDate_mxodbc()}
+ self.dbapi_type_map = {'getdate' : SybaseDate_mxodbc()}
def import_dbapi(cls):
#import mx.ODBC.Windows as module
@@ -686,9 +685,7 @@ class SybaseSQLDialect_mxodbc(SybaseSQLDialect):
class SybaseSQLDialect_pyodbc(SybaseSQLDialect):
def __init__(self, **params):
super(SybaseSQLDialect_pyodbc, self).__init__(**params)
-
- def dbapi_type_map(self):
- return {'getdate' : SybaseDate_pyodbc()}
+ self.dbapi_type_map = {'getdate' : SybaseDate_pyodbc()}
def import_dbapi(cls):
import mypyodbc as module