gbwey / persistent-odbc

uses persistent connecting via hdbc odbc
Other
17 stars 16 forks source link

mssql blobs are not working #1

Closed gbwey closed 11 years ago

gbwey commented 11 years ago

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.

gbwey commented 11 years ago

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"}}]

gbwey commented 11 years ago

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\"]"}