The Oracle LONG type, while an unbounded text type, does not appear

to use the cx_Oracle.LOB type when result rows are returned,
so the dialect has been repaired to exclude LONG from
having cx_Oracle.LOB filtering applied.
[ticket:2620]
This commit is contained in:
Mike Bayer 2012-12-06 19:32:58 -05:00
parent a1405b3d5a
commit f2909ff71b
3 changed files with 36 additions and 0 deletions

View File

@ -27,6 +27,15 @@
to the MSSQL dialect's "schema rendering"
logic's failure to take .key into account.
.. change::
:tags: oracle, bug
:tickets: 2620
The Oracle LONG type, while an unbounded text type, does not appear
to use the cx_Oracle.LOB type when result rows are returned,
so the dialect has been repaired to exclude LONG from
having cx_Oracle.LOB filtering applied.
.. change::
:tags: oracle, bug
:tickets: 2611

View File

@ -283,6 +283,13 @@ class _OracleText(_LOBMixin, sqltypes.Text):
def get_dbapi_type(self, dbapi):
return dbapi.CLOB
class _OracleLong(oracle.LONG):
# a raw LONG is a text type, but does *not*
# get the LobMixin with cx_oracle.
def get_dbapi_type(self, dbapi):
return dbapi.LONG_STRING
class _OracleString(_NativeUnicodeMixin, sqltypes.String):
pass
@ -502,6 +509,11 @@ class OracleDialect_cx_oracle(OracleDialect):
sqltypes.String : _OracleString,
sqltypes.UnicodeText : _OracleUnicodeText,
sqltypes.CHAR : _OracleChar,
# a raw LONG is a text type, but does *not*
# get the LobMixin with cx_oracle.
oracle.LONG: _OracleLong,
sqltypes.Integer : _OracleInteger, # this is only needed for OUT parameters.
# it would be nice if we could not use it otherwise.
oracle.RAW: _OracleRaw,

View File

@ -1189,6 +1189,21 @@ class TypesTest(fixtures.TestBase):
finally:
t1.drop()
@testing.provide_metadata
def test_long_type(self):
metadata = self.metadata
t = Table('t', metadata,
Column('data', oracle.LONG)
)
metadata.create_all(testing.db)
testing.db.execute(t.insert(), data='xyz')
eq_(
testing.db.scalar(select([t.c.data])),
"xyz"
)
def test_longstring(self):
metadata = MetaData(testing.db)