HDBC 2.2.6.1 → 2.2.7.0
raw patch · 3 files changed
+19/−10 lines, 3 filesdep +textdep ~convertiblePVP ok
version bump matches the API change (PVP)
Dependencies added: text
Dependency ranges changed: convertible
API changes (from Hackage documentation)
+ Database.HDBC.SqlValue: instance Convertible SqlValue Text
+ Database.HDBC.SqlValue: instance Convertible Text SqlValue
Files
- Database/HDBC/SqlValue.hs +15/−3
- Database/HDBC/Utils.hs +2/−5
- HDBC.cabal +2/−2
Database/HDBC/SqlValue.hs view
@@ -21,6 +21,8 @@ import Data.Ratio import Data.Convertible import Data.Fixed+import qualified Data.Text as TS+import qualified Data.Text.Lazy as TL quickError :: (Typeable a, Convertible SqlValue a) => SqlValue -> ConvertResult a quickError sv = convError "incompatible types" sv@@ -277,6 +279,18 @@ safeConvert (SqlTimeDiff x) = return . show $ x safeConvert y@(SqlNull) = quickError y +instance Convertible TS.Text SqlValue where+ safeConvert = return . SqlString . TS.unpack++instance Convertible SqlValue TS.Text where+ safeConvert = fmap TS.pack . safeConvert++instance Convertible TL.Text SqlValue where+ safeConvert = return . SqlString . TL.unpack++instance Convertible SqlValue TL.Text where+ safeConvert = fmap TL.pack . safeConvert+ #ifdef __HUGS__ instance Typeable B.ByteString where typeOf _ = mkTypeName "ByteString"@@ -498,9 +512,7 @@ safeConvert (SqlString [x]) = return x safeConvert y@(SqlString _) = convError "String length /= 1" y safeConvert y@(SqlByteString x) = - case B.length x of- 1 -> safeConvert . SqlString . BUTF8.toString $ x- _ -> convError "ByteString length /= 1" y+ safeConvert . SqlString . BUTF8.toString $ x safeConvert y@(SqlInt32 _) = quickError y safeConvert y@(SqlInt64 _) = quickError y safeConvert y@(SqlWord32 _) = quickError y
Database/HDBC/Utils.hs view
@@ -39,7 +39,6 @@ import Database.HDBC.Types import qualified Data.Map as Map import Control.Exception-import Data.Char import System.IO.Unsafe import Data.List(genericLength) @@ -231,8 +230,7 @@ do row <- fetchRow sth case row of Nothing -> return Nothing- Just r -> do names_raw <- getColumnNames sth- let names = map (map toLower) names_raw+ Just r -> do names <- getColumnNames sth return $ Just $ zip names r {- | Strict version of 'fetchRowAL' -}@@ -268,8 +266,7 @@ See 'fetchRowAL' for more details. -} fetchAllRowsAL :: Statement -> IO [[(String, SqlValue)]] fetchAllRowsAL sth =- do names_raw <- getColumnNames sth- let names = map (map toLower) names_raw+ do names <- getColumnNames sth rows <- fetchAllRows sth return $ map (zip names) rows
HDBC.cabal view
@@ -1,5 +1,5 @@ Name: HDBC-Version: 2.2.6.1+Version: 2.2.7.0 License: LGPL Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen@@ -37,7 +37,7 @@ Build-Depends: time<1.1.3 else Build-Depends: base<3- Build-Depends: mtl, convertible >= 1.0.9.1, utf8-string+ Build-Depends: mtl, convertible >= 1.0.10.0, text, utf8-string -- Hack for cabal-install weirdness. cabal-install forces base 3, -- though it works fine for Setup.lhs manually. Fix.