diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-01-23 20:25:48 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-01-23 20:25:48 +0000 |
| commit | b8662333bbd20194ca3117835e7e1ca0bb4d3c0b (patch) | |
| tree | 99af5845375f62b0b73012c4cdd3ef6fbe3c35d6 /test/sql | |
| parent | b5673a19381bbdc170a2a2deff1c8fc74a087d62 (diff) | |
| download | sqlalchemy-b8662333bbd20194ca3117835e7e1ca0bb4d3c0b.tar.gz | |
- *slight* support for binary, but still need to figure out how to insert reasonably largerel_0_3_4
values (over 4K). requires auto_setinputsizes=True sent to create_engine(), rows must
be fully fetched individually, etc.
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/testtypes.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/test/sql/testtypes.py b/test/sql/testtypes.py index 8889b7b34..8606f1b74 100644 --- a/test/sql/testtypes.py +++ b/test/sql/testtypes.py @@ -186,7 +186,7 @@ class BinaryTest(AssertMixin): def setUpAll(self): global binary_table binary_table = Table('binary_table', db, - Column('primary_id', Integer, primary_key=True), + Column('primary_id', Integer, Sequence('binary_id_seq', optional=True), primary_key=True), Column('data', Binary), Column('data_slice', Binary(100)), Column('misc', String(30)), @@ -199,16 +199,27 @@ class BinaryTest(AssertMixin): def tearDownAll(self): binary_table.drop() - @testbase.unsupported('oracle') def testbinary(self): testobj1 = pickleable.Foo('im foo 1') testobj2 = pickleable.Foo('im foo 2') - stream1 =self.load_stream('binary_data_one.dat') - stream2 =self.load_stream('binary_data_two.dat') + if db.name == 'oracle': + stream1 =self.load_stream('binary_data_one.dat', len=2000) + stream2 =self.load_stream('binary_data_two.dat', len=2000) + else: + stream1 =self.load_stream('binary_data_one.dat') + 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) - l = binary_table.select().execute().fetchall() + 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() 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'])) @@ -216,10 +227,10 @@ class BinaryTest(AssertMixin): self.assert_(testobj1 == l[0]['pickled']) self.assert_(testobj2 == l[1]['pickled']) - def load_stream(self, name): + def load_stream(self, name, len=12579): f = os.path.join(os.path.dirname(testbase.__file__), name) # put a number less than the typical MySQL default BLOB size - return file(f).read(12579) + return file(f).read(len) class DateTest(AssertMixin): def setUpAll(self): |
