From: <kr_...@us...> - 2004-02-25 11:02:27
|
Update of /cvsroot/htoolkit/HSQL/src/HSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19986/src/HSQL Modified Files: Types.hs Log Message: Added custon instance for Show SqlError. The new instance converts the SqlError value to user readable string. Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/HSQL/src/HSQL/Types.hs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Types.hs 10 Feb 2004 11:30:52 -0000 1.5 --- Types.hs 25 Feb 2004 10:47:16 -0000 1.6 *************** *** 84,88 **** | SqlUnsupportedOperation | SqlClosedHandle - deriving Show sqlErrorTc :: TyCon --- 84,87 ---- *************** *** 92,95 **** --- 91,105 ---- typeOf _ = mkAppTy sqlErrorTc [] + instance Show SqlError where + showsPrec _ (SqlError{seErrorMsg=msg}) = showString msg + showsPrec _ SqlNoData = showString "No data" + showsPrec _ SqlInvalidHandle = showString "Invalid handle" + showsPrec _ SqlStillExecuting = showString "Stlll executing" + showsPrec _ SqlNeedData = showString "Need data" + showsPrec _ (SqlBadTypeCast name tp) = showString ("The type of " ++ name ++ " field can't be converted to " ++ show tp ++ " type") + showsPrec _ (SqlFetchNull name) = showString ("The value of " ++ name ++ " field is null") + showsPrec _ (SqlUnknownField name) = showString ("Unknown field name: " ++ name) + showsPrec _ SqlUnsupportedOperation = showString "Unsupported operation" + showsPrec _ SqlClosedHandle = showString "The referenced handle is already closed" -- | A 'Connection' type represents a connection to a database, through which you can operate on the it. |