[Haskell-cafe] HaskellDB Convertible Exception: incompatible types

Andras Gyomrey lgandras at gmail.com
Thu Oct 4 21:21:01 CEST 2012


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121004/5e5ba923/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: haskelldb-2.1.1.patch
Type: application/octet-stream
Size: 4793 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121004/5e5ba923/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: haskelldb-hdbc-2.1.0.patch
Type: application/octet-stream
Size: 917 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121004/5e5ba923/attachment-0001.obj>


More information about the Haskell-Cafe mailing list