]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fixed oracle list of binary types to check for their presence in the module (such...
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 17 Feb 2007 01:18:54 +0000 (01:18 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 17 Feb 2007 01:18:54 +0000 (01:18 +0000)
- removed oracle-handicap from binary unit test to test [ticket:435] fix, added an extra row containing None

lib/sqlalchemy/databases/oracle.py
test/sql/testtypes.py

index e1c82450fd926b546f5f9c9c362c00b2b42e7977..8f6ce4772ba819e2245432adc56a169669aa7f33 100644 (file)
@@ -20,6 +20,9 @@ try:
     import cx_Oracle
 except:
     cx_Oracle = None
+
+ORACLE_BINARY_TYPES = [getattr(cx_Oracle, k) for k in ["BFILE", "CLOB", "NCLOB", "BLOB", "LONG_BINARY", "LONG_STRING"] if hasattr(cx_Oracle, k)]
+
         
 class OracleNumeric(sqltypes.Numeric):
     def get_col_spec(self):
@@ -326,8 +329,7 @@ class OracleDialect(ansisql.ANSIDialect):
         if cursor and cursor.description:
             for column in cursor.description:
                 type_code = column[1]
-                if type_code in (cx_Oracle.BFILE, cx_Oracle.CLOB, cx_Oracle.NCLOB,
-                                 cx_Oracle.BLOB, cx_Oracle.LONG_BINARY, cx_Oracle.LONG_STRING):
+                if type_code in ORACLE_BINARY_TYPES:
                     args['should_prefetch'] = True
                     break
         return args
index 8606f1b74c5c05779c69debbd00362770d916d44..e924d08ca4f39f9a8497f1e448f4827cdd3ac4f6 100644 (file)
@@ -211,15 +211,8 @@ class BinaryTest(AssertMixin):
             stream2 =self.load_stream('binary_data_two.dat')
         binary_table.insert().execute(primary_id=1, misc='binary_data_one.dat',    data=stream1, data_slice=stream1[0:100], pickled=testobj1)
         binary_table.insert().execute(primary_id=2, misc='binary_data_two.dat', data=stream2, data_slice=stream2[0:99], pickled=testobj2)
-        if db.name == 'oracle':
-            res = binary_table.select().execute()
-            l = []
-            row = res.fetchone()
-            l.append(dict([(k, row[k]) for k in row.keys()]))
-            row = res.fetchone()
-            l.append(dict([(k, row[k]) for k in row.keys()]))
-        else:
-            l = binary_table.select().execute().fetchall()
+        binary_table.insert().execute(primary_id=3, misc='binary_data_two.dat', data=None, data_slice=stream2[0:99], pickled=None)
+        l = binary_table.select().execute().fetchall()
         print len(stream1), len(l[0]['data']), len(l[0]['data_slice'])
         self.assert_(list(stream1) == list(l[0]['data']))
         self.assert_(list(stream1[0:100]) == list(l[0]['data_slice']))