gbwey/persistent-odbc

mssql blobs are not working

gbwey opened this issue · 2 comments

informat/outformat problems with blobs. Can insert "0102" (as long as there are an event number of 0-f pairs) but not eg "zzz"
Also cannot "select" any blobs.

if you do this insert manually then select using persist works:so the trick is to do the cast when inserting.

insert into testother values(cast ('hello world' as varbinary(max)),cast ('this is a test' as varbinary(max)));

-- this works
xs <- selectList ([]::[Filter Testother]) []
liftIO $ putStrLn $ "xs=" ++ show xs

xs=[Entity {entityKey = Key {unKey = PersistInt64 1}, entityVal = Testother
{testotherBs1 = Just "hello world", testotherBs2 = "this is a test"}},Entity
{entityKey = Key {unKey = PersistInt64 2}, entityVal = Testother {testother
Bs1 = Just "hello world", testotherBs2 = "this is a test"}}]

mssql insert into blobs work except cannot insert a null (i change it to a empty string)
for normal inserts: convert(varbinary(max),?)
for null inserts: isnull(?,'')

error on null insert into blog is:
*** Exception: SqlError {seState = "["HY104"]", seNativeError = -1,
seErrorMsg = "bindparameter NULL 1: ["0: [Microsoft][ODBC SQL Server Driver]Invalid precision value"]"}