On Wed, Nov 22, 2006 at 09:48:40AM -0200, Marco T?lio Gontijo e Silva wrote:
> Package: libghc6-hdbc-dev
> Version: 1.0.1.1
> Severity: important
> Tags: patch
> 
> It's not possible to compare SqlNull to any other constructor of SqlType.
> 
> Prelude Database.HDBC> SqlString "Marco" == SqlNull
> *** Exception: fromSql: cannot convert SqlNull to String
> 
> This is specially bad when I want to filter all the SqlNull from a list of
> SqlTypes.

Hello Marco,

Thank you for reporting the bug.  However, I believe that it is not a
bug, and that your suggested fix could be harmful.

The problem with converting a SQL NULL into a string is that you could
have that string stored in SQL.  You should really be comparing to a
(Just String) or Nothing, as in:

Prelude Database.HDBC> fromSql (SqlString "Marco") == "Marco"
True
Prelude Database.HDBC> fromSql (SqlString "Marco") == Nothing
False
Prelude Database.HDBC> fromSql SqlNull == Nothing
True
Prelude Database.HDBC> fromSql (SqlString "Marco") == Just "Marco"
True

My current plan is to close this bug without making a change, but I'd
like to hear your response first.

-- John


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to