]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
The Oracle LONG type, while an unbounded text type, does not appear
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 7 Dec 2012 00:30:49 +0000 (19:30 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 7 Dec 2012 00:30:49 +0000 (19:30 -0500)
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.  Also in 0.7.10.
[ticket:2620]

doc/build/changelog/changelog_07.rst
doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/oracle/cx_oracle.py
test/dialect/test_oracle.py

index 1bb483280f7964107cdac9ecd9523a1c7b07be32..092e8af40fbc77e5348beac23c891dc1d64db769 100644 (file)
@@ -8,6 +8,15 @@
     :version: 0.7.10
     :released:
 
+    .. 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
index dad8df6ce002e20a100620caa96e428ddc345aab..79597366c9e3da298454adf70314c3891c7b5b2d 100644 (file)
@@ -6,6 +6,15 @@
 .. changelog::
     :version: 0.8.0b2
 
+    .. 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.  Also in 0.7.10.
+
     .. change::
         :tags: oracle, bug
         :tickets: 2611
index 8b60d9af816676c566e528057eb8ccdc01601879..c5d9e8a89700cb3e67f1866a40e60bdf34e3a73e 100644 (file)
@@ -303,6 +303,13 @@ class _OracleText(_LOBMixin, sqltypes.Text):
         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
 
@@ -532,6 +539,10 @@ class OracleDialect_cx_oracle(OracleDialect):
         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,
+
         # this is only needed for OUT parameters.
         # it would be nice if we could not use it otherwise.
         sqltypes.Integer: _OracleInteger,
index 7604bf9287363c1f9ee78894d4180a021f02528a..80ab91a9199d41542c939c2d68cd2a9ac85dc2f7 100644 (file)
@@ -1315,6 +1315,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)