simplest-sqlite 0.1.0.9 → 0.1.1.0
raw patch · 2 files changed
+16/−4 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Database.SmplstSQLite3: bindN' :: Bindable a => Stmt -> Int -> a -> IO ()
+ Database.SmplstSQLite3: class Bindable a
+ Database.SmplstSQLite3: class Columnable a
+ Database.SmplstSQLite3: column' :: Columnable a => Stmt -> Int -> IO a
+ Database.SmplstSQLite3: instance Database.SmplstSQLite3.SQLiteData a => Database.SmplstSQLite3.Bindable a
+ Database.SmplstSQLite3: instance Database.SmplstSQLite3.SQLiteData a => Database.SmplstSQLite3.Columnable a
- Database.SmplstSQLite3: bind :: SQLiteData a => Stmt -> String -> a -> IO ()
+ Database.SmplstSQLite3: bind :: Bindable a => Stmt -> String -> a -> IO ()
Files
- simplest-sqlite.cabal +1/−1
- src/Database/SmplstSQLite3.hs +15/−3
simplest-sqlite.cabal view
@@ -2,7 +2,7 @@ cabal-version: >= 1.10 name: simplest-sqlite-version: 0.1.0.9+version: 0.1.1.0 stability: Experimental author: YoshikuniJujo <PAF01143@nifty.ne.jp> maintainer: YoshikuniJujo <PAF01143@nifty.ne.jp>
src/Database/SmplstSQLite3.hs view
@@ -1,12 +1,18 @@ {-# LANGUAGE LambdaCase, TupleSections #-} {-# LANGUAGE TypeApplications #-}+{-# LANGUAGE FlexibleInstances, UndecidableInstances #-} module Database.SmplstSQLite3 (+ -- * Functions withSQLite, withPrepared,- step, reset, bind, SQLiteData(..), SQLiteDataList(..), columnType,+ step, reset, bind,+ SQLiteData(..), SQLiteDataList(..), columnType,+ Bindable(..), Columnable(..),+ -- * Types SQLite, Stmt, Result(..), Type(..), SQLiteException(..),+ ) where import Control.Monad@@ -118,6 +124,12 @@ bindN :: Stmt -> Int -> a -> IO () column :: Stmt -> Int -> IO a +class Bindable a where bindN' :: Stmt -> Int -> a -> IO ()+class Columnable a where column' :: Stmt -> Int -> IO a++instance SQLiteData a => Bindable a where bindN' = bindN+instance SQLiteData a => Columnable a where column' = column+ instance SQLiteData a => SQLiteData (Maybe a) where bindN stmt i Nothing = sqlite3BindNull stmt i () bindN stmt i (Just x) = bindN stmt i x@@ -198,8 +210,8 @@ foreign import ccall unsafe "sqlite3.h sqlite3_bind_blob" c_sqlite3_bind_blob :: Ptr Stmt -> CInt -> CString -> CInt -> Ptr a -> IO CInt -bind :: SQLiteData a => Stmt -> String -> a -> IO ()-bind sm ph x = flip (bindN sm) x =<< sqlite3BindParameterIndex sm ph+bind :: Bindable a => Stmt -> String -> a -> IO ()+bind sm ph x = flip (bindN' sm) x =<< sqlite3BindParameterIndex sm ph sqlite3BindNull :: Stmt -> Int -> () -> IO () sqlite3BindNull (Stmt sm) i _ = do