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.
This patch should contain the fix to the problem.
[EMAIL PROTECTED]:~/dados/texto/codigo/haskell/hdbc/Database/HDBC$ diff -ruN
Types.hs Types.2.hs
--- Types.hs 2006-06-28 16:57:03.000000000 -0300
+++ Types.2.hs 2006-11-22 09:29:09.000000000 -0200
@@ -363,6 +363,7 @@
SqlEpochTime a == SqlEpochTime b = a == b
SqlTimeDiff a == SqlTimeDiff b = a == b
SqlNull == SqlNull = True
+ SqlNull == a = False
a == b = ((fromSql a)::String) == ((fromSql b)::String)
instance SqlType String where
[EMAIL PROTECTED]:~/dados/texto/codigo/haskell/hdbc/Database/HDBC$
Or maybe change the instance to a valid Show SqlNull:
[EMAIL PROTECTED]:~/dados/texto/codigo/haskell/hdbc/Database/HDBC$ diff -ruN
Types.hs Types.2.hs
--- Types.hs 2006-11-22 09:43:30.000000000 -0200
+++ Types.2.hs 2006-11-22 09:43:12.000000000 -0200
@@ -379,7 +379,7 @@
fromSql (SqlRational x) = show x
fromSql (SqlEpochTime x) = show x
fromSql (SqlTimeDiff x) = show x
- fromSql (SqlNull) = error "fromSql: cannot convert SqlNull to String"
+ fromSql (SqlNull) = "SqlNull"
instance SqlType Int where
toSql x = SqlInt32 (fromIntegral x)
[EMAIL PROTECTED]:~/dados/texto/codigo/haskell/hdbc/Database/HDBC$
But this could be a problem when comparing with something like SqlString
"SqlNull".
-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-2-686
Locale: LANG=pt_BR, LC_CTYPE=pt_BR (charmap=ISO-8859-1)
Versions of packages libghc6-hdbc-dev depends on:
ii ghc6 6.4.2-2 GHC - the Glasgow Haskell Compilat
libghc6-hdbc-dev recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]