Update of /cvsroot/htoolkit/HSQL/MySQL/Database/HSQL
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7000/MySQL/Database/HSQL
Modified Files:
MySQL.hsc
Log Message:
Another way to handle null values in HSQL. Not tested yet.
Index: MySQL.hsc
===================================================================
RCS file: /cvsroot/htoolkit/HSQL/MySQL/Database/HSQL/MySQL.hsc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MySQL.hsc 17 Jun 2005 08:43:51 -0000 1.1
--- MySQL.hsc 12 Dec 2005 15:21:56 -0000 1.2
***************
*** 201,216 ****
return ((pRow, pLengths), pRow /= nullPtr)
! getColValue :: MVar (MYSQL_ROW, MYSQL_LENGTHS) -> Int -> FieldDef -> (SqlType -> CString -> Int -> IO (Maybe a)) -> IO (Maybe a)
! getColValue currRow colNumber (name,sqlType,nullable) f = do
(row, lengths) <- readMVar currRow
pValue <- peekElemOff row colNumber
len <- fmap fromIntegral (peekElemOff lengths colNumber)
! if pValue == nullPtr
! then return Nothing
! else do
! mv <- f sqlType pValue len
! case mv of
! Just v -> return (Just v)
! Nothing -> throwDyn (SqlBadTypeCast name sqlType)
tables :: Connection -> MYSQL -> IO [String]
--- 201,210 ----
return ((pRow, pLengths), pRow /= nullPtr)
! getColValue :: MVar (MYSQL_ROW, MYSQL_LENGTHS) -> Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a
! getColValue currRow colNumber fieldDef f = do
(row, lengths) <- readMVar currRow
pValue <- peekElemOff row colNumber
len <- fmap fromIntegral (peekElemOff lengths colNumber)
! f fieldDef pValue len
tables :: Connection -> MYSQL -> IO [String]
|