is like `col.in_(text("select id from table"))`.
[ticket:1793]
+ - Columns of _Binary type (i.e. LargeBinary, BLOB, etc.)
+ will coerce a "basestring" on the right side into a
+ _Binary as well so that required DBAPI processing
+ takes place.
+
- Added table.add_is_dependent_on(othertable), allows manual
placement of dependency rules between two Table objects
for use within create_all(), drop_all(), sorted_tables.
process = processors.to_str
return process
# end Py2K
+
+ def _coerce_compared_value(self, op, value):
+ if isinstance(value, basestring):
+ return self
+ else:
+ return super(_Binary, self)._coerce_compared_value(op, value)
def adapt(self, impltype):
return impltype(length=self.length)
eq_(testobj2, l[1]['pickled'])
eq_(testobj3.moredata, l[0]['mypickle'].moredata)
eq_(l[0]['mypickle'].stuff, 'this is the right stuff')
-
+
+ def test_comparison(self):
+ """test that type coercion occurs on comparison for binary"""
+
+ expr = binary_table.c.data == 'foo'
+ assert isinstance(expr.right.type, LargeBinary)
+
+ data = os.urandom(32)
+ binary_table.insert().execute(data=data)
+ eq_(binary_table.select().where(binary_table.c.data==data).count().scalar(), 1)
+
+
def load_stream(self, name):
f = os.path.join(os.path.dirname(__file__), "..", name)
return open(f, mode='rb').read()