Andras Gyomrey | 29 Sep 23:56 2012
Picon

HaskellDB Convertible Exception: incompatible types

Hi,

I get

*** Exception: Convertible: error converting source data SqlLocalTime 2012-04-27 10:22:15 of type SqlValue to type Data.Time.LocalTime.LocalTime.ZonedTime: incompatible types

when i try to show a record with a field of type CalendarTime (automatically generated by Database.HaskellDB.DBDirect, Mysql database type is "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"

I already looked forhttp://haskell.1045720.n5.nabble.com/programmatic-DB-interface-td3120759.html. But the problem there is about a regexp (not a type). And the incompatible type problem was caused because of a concatenation. Here, as you can see, i have no idea what's going on.

Can someone please help me?

Andras

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Andras Gyomrey | 4 Oct 21:21 2012
Picon

Re: HaskellDB Convertible Exception: incompatible types

Hi,

going deeper i found the following:

http://hackage.haskell.org/packages/archive/haskelldb-hdbc/2.1.0/doc/html/src/Database-HaskellDB-HDBC.html#line-126

HaskellDB is converting from SqlTimestampT (no timezone defined) to CalendarTimeT (timezone required). This conversion tries then to be done using LocalTime (http://hackage.haskell.org/packages/archive/HDBC/2.2.6.1/doc/html/src/Database-HDBC-SqlValue.html#line-735)
 which fails.

I believe real problem is CalendarTimeT. SqlTimestampT clearly doesn't define a timezone. There's a need to create a new type to handle these types. Timestamps but no timezone (Localtime).

I attach a patch for this. I tested this in a project. Not quite sure how to add the tests. What should i do to add this patch to haskell? A version dependency of this two should be added,

Andras


2012/9/29 Andras Gyomrey <lgandras <at> gmail.com>
Hi,

I get

*** Exception: Convertible: error converting source data SqlLocalTime 2012-04-27 10:22:15 of type SqlValue to type Data.Time.LocalTime.LocalTime.ZonedTime: incompatible types

when i try to show a record with a field of type CalendarTime (automatically generated by Database.HaskellDB.DBDirect, Mysql database type is "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"

I already looked forhttp://haskell.1045720.n5.nabble.com/programmatic-DB-interface-td3120759.html. But the problem there is about a regexp (not a type). And the incompatible type problem was caused because of a concatenation. Here, as you can see, i have no idea what's going on.

Can someone please help me?

Andras


Attachment (haskelldb-2.1.1.patch): application/octet-stream, 6476 bytes
Attachment (haskelldb-hdbc-2.1.0.patch): application/octet-stream, 1240 bytes
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane