Number fields in Oracle 11gR2
paulrzcz opened this issue · 2 comments
paulrzcz commented
Hi,
I've tried to work with legacy DB in our company with persistent-odbc 0.2.0.1 and I am getting the following marshalling error:
tariff-zone-exe.exe: PersistMarshalError "field treeId: int32 Expected Integer, received: PersistByteString \"123\""
My environment is:
- Windows 7 x64 Enterprise
- GHC 7.10.2 x64 for Windows
The Haskell code is:
runDB = runResourceT . runNoLoggingT . withODBCConn (Just $ Oracle False) "dsn=pc-test5;PWD=<some pwd>" . runSqlConn
share [mkPersist sqlSettings] [persistUpperCase|
TariffZone sql=TARIFF_ZONE
Id Int32 sql=TARIFF_ZONE_ID
name String sql=TARIFF_ZONE_NAME
name2 String Maybe sql=TARIFF_ZONE_NAME2
description String Maybe sql=DESCRIPTION
treeId Int32 sql=TARIFF_ZONE_TREE_ID
parentId Int32 sql=PARENT_TARIFF_ZONE_ID
deriving Show
|]
main :: IO ()
main = do
tz <- runDB $ do
select $
from $ \tz -> do
where_ (tz ^. TariffZoneName `like` val "Roam_Voice_Out.fromZone1.France%")
orderBy [asc (tz ^. TariffZoneName)]
return tz
mapM_ (putStrLn . show) tz
return ()
Table definition is:
CREATE TABLE "TARIFF_ZONE"
( "TARIFF_ZONE_ID" NUMBER(*,0) NOT NULL,
"TARIFF_ZONE_TREE_ID" NUMBER(*,0) NOT NULL,
"PARENT_TARIFF_ZONE_ID" NUMBER(*,0),
"TARIFF_ZONE_NAME" VARCHAR2(128 BYTE) NOT NULL,
"TARIFF_ZONE_NAME2" NVARCHAR2(128),
"DESCRIPTION" VARCHAR2(256 BYTE),
CONSTRAINT "PK_TARIFF_ZONE" PRIMARY KEY ("TARIFF_ZONE_ID")
);
gbwey commented
HI,
I have made changes to the Persistent project that should fix the problems with int32.
Just make sure to use at least persistent-2.2.2.1 with persistent-odbc and it should work.
Let me know how it goes.
Best,
Grant
paulrzcz commented
Just tested. It works properly now. I will try to use it more in my daily job. Thanks a lot!