- break out binary insert against None, disable for freetds for now

This commit is contained in:
Mike Bayer
2015-05-24 17:08:02 -04:00
parent 96f49085b8
commit 0198d9aa5f
2 changed files with 41 additions and 13 deletions
+37 -12
View File
@@ -772,18 +772,6 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults):
pickled=testobj2,
)
# TODO: pyodbc does not seem to accept "None" for a VARBINARY
# column (data=None). error: [Microsoft][ODBC SQL Server
# Driver][SQL Server]Implicit conversion from data type varchar
# to varbinary is not allowed. Use the CONVERT function to run
# this query. (257) binary_table.insert().execute(primary_id=3,
# misc='binary_data_two.dat', data=None, data_image=None,
# data_slice=stream2[0:99], pickled=None)
binary_table.insert().execute(
primary_id=3,
misc='binary_data_two.dat', data_image=None,
data_slice=stream2[0:99], pickled=None)
for stmt in \
binary_table.select(order_by=binary_table.c.primary_id), \
text(
@@ -807,6 +795,43 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults):
eq_(testobj3.moredata, l[0]['mypickle'].moredata)
eq_(l[0]['mypickle'].stuff, 'this is the right stuff')
@testing.requires.no_mssql_freetds
def test_binary_none(self):
# TODO: pyodbc does not seem to accept "None" for a VARBINARY
# column (data=None). error: [Microsoft][ODBC SQL Server
# Driver][SQL Server]Implicit conversion from data type varchar
# to varbinary is not allowed. Use the CONVERT function to run
# this query. (257) binary_table.insert().execute(primary_id=3,
# misc='binary_data_two.dat', data=None, data_image=None,
# data_slice=stream2[0:99], pickled=None)
stream2 = self.load_stream('binary_data_two.dat')
binary_table.insert().execute(
primary_id=3,
misc='binary_data_two.dat', data_image=None,
data_slice=stream2[0:99], pickled=None)
for stmt in \
binary_table.select(), \
text(
'select * from binary_table',
typemap=dict(
data=mssql.MSVarBinary(8000),
data_image=mssql.MSImage,
data_slice=types.BINARY(100), pickled=PickleType,
mypickle=MyPickleType),
bind=testing.db):
row = stmt.execute().first()
eq_(
row['pickled'], None
)
eq_(
row['data_image'], None
)
eq_(
row['data_slice'], stream2[0:99]
)
def load_stream(self, name, len=3000):
fp = open(
os.path.join(os.path.dirname(__file__), "..", "..", name), 'rb')
+4 -1
View File
@@ -810,12 +810,15 @@ class DefaultRequirements(SuiteRequirements):
)
)
@property
def no_mssql_freetds(self):
return self.mssql_freetds.not_()
@property
def selectone(self):
"""target driver must support the literal statement 'select 1'"""
return skip_if(["oracle", "firebird"], "non-standard SELECT scalar syntax")
@property
def mysql_fully_case_sensitive(self):
return only_if(self._has_mysql_fully_case_sensitive)