persistent-mysql 1.0.0 → 1.0.1
raw patch · 2 files changed
+16/−18 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Database/Persist/MySQL.hs +15/−17
- persistent-mysql.cabal +1/−1
Database/Persist/MySQL.hs view
@@ -226,11 +226,10 @@ getGetter MySQLBase.Double = convertPV PersistDouble getGetter MySQLBase.Decimal = convertPV PersistDouble getGetter MySQLBase.NewDecimal = convertPV PersistDouble--- Text-getGetter MySQLBase.VarChar = convertPV persistText-getGetter MySQLBase.VarString = convertPV persistText-getGetter MySQLBase.String = convertPV persistText--- ByteString+-- ByteString and Text+getGetter MySQLBase.VarChar = convertPV PersistByteString+getGetter MySQLBase.VarString = convertPV PersistByteString+getGetter MySQLBase.String = convertPV PersistByteString getGetter MySQLBase.Blob = convertPV PersistByteString getGetter MySQLBase.TinyBlob = convertPV PersistByteString getGetter MySQLBase.MediumBlob = convertPV PersistByteString@@ -251,10 +250,7 @@ getGetter other = error $ "MySQL.getGetter: type " ++ show other ++ " not supported." -persistText :: ByteString -> PersistValue-persistText = PersistText . T.decodeUtf8 - ---------------------------------------------------------------------- @@ -393,7 +389,9 @@ getColumn connectInfo getter (entityDB def) helperCntrs = do- let check [PersistText cntrName, PersistText clmnName] = return (cntrName, clmnName)+ let check [ PersistByteString cntrName+ , PersistByteString clmnName] = return ( T.decodeUtf8 cntrName+ , T.decodeUtf8 clmnName ) check other = fail $ "helperCntrs: unexpected " ++ show other rows <- mapM check =<< CL.consume return $ map (Right . Right . (DBName . fst . head &&& map (DBName . snd)))@@ -406,9 +404,9 @@ -> DBName -> [PersistValue] -> IO (Either Text Column)-getColumn connectInfo getter tname [ PersistText cname- , PersistText null_- , PersistText type'+getColumn connectInfo getter tname [ PersistByteString cname+ , PersistByteString null_+ , PersistByteString type' , default'] = fmap (either (Left . pack) Right) $ runErrorT $ do@@ -439,17 +437,17 @@ \COLUMN_NAME" let vars = [ PersistText $ pack $ MySQL.connectDatabase connectInfo , PersistText $ unDBName $ tname- , PersistText $ cname+ , PersistByteString cname , PersistText $ pack $ MySQL.connectDatabase connectInfo ] cntrs <- runResourceT $ withStmt stmt vars $$ CL.consume ref <- case cntrs of [] -> return Nothing- [[PersistText tab, PersistText ref]] ->- return $ Just (DBName tab, DBName ref)+ [[PersistByteString tab, PersistByteString ref]] ->+ return $ Just (DBName $ T.decodeUtf8 tab, DBName $ T.decodeUtf8 ref) _ -> fail "MySQL.getColumn/getRef: never here" -- Okay!- return $ Column (DBName cname) (null_ == "YES") type_ default_ Nothing ref -- FIXME: maxLen+ return $ Column (DBName $ T.decodeUtf8 cname) (null_ == "YES") type_ default_ Nothing ref -- FIXME: maxLen getColumn _ _ _ x = return $ Left $ pack $ "Invalid result from INFORMATION_SCHEMA: " ++ show x@@ -457,7 +455,7 @@ -- | Parse the type of column as returned by MySQL's -- @INFORMATION_SCHEMA@ tables.-parseType :: Monad m => Text -> m SqlType+parseType :: Monad m => ByteString -> m SqlType parseType "tinyint" = return SqlBool -- Ints parseType "int" = return SqlInt32
persistent-mysql.cabal view
@@ -1,5 +1,5 @@ name: persistent-mysql-version: 1.0.0+version: 1.0.1 license: MIT license-file: LICENSE author: Felipe Lessa <felipe.lessa@gmail.com>, Michael Snoyman