simplest-sqlite 0.0.0.14 → 0.1.0.0
raw patch · 4 files changed
+36/−8 lines, 4 filesdep ~exception-hierarchydep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: exception-hierarchy, template-haskell
API changes (from Hackage documentation)
Files
- samples/hello.hs +24/−0
- simplest-sqlite.cabal +6/−3
- src/Database/SmplstSQLite3.hs +0/−1
- src/Database/SmplstSQLite3/Templates.hs +6/−4
+ samples/hello.hs view
@@ -0,0 +1,24 @@+import Database.SmplstSQLite3++main :: IO ()+main = withSQLite "test.sqlite3" $ \db -> do+-- withPrepared db "CREATE TABLE greeting(id, words, greetee)" step >>= print+ withPrepared db+ "INSERT INTO greeting VALUES(?, ?, 'world')" $ \sm -> do+ bindN sm 1 (155 :: Int)+ bindN sm 2 "good-bye"+ step sm+ reset sm+ bindN sm 1 (222 :: Int)+ bindN sm 2 "hoge"+ step sm+ withPrepared db "SELECT * FROM greeting" $ \sm -> do+ step sm+ column sm 0 >>= (print :: Int -> IO ())+ column sm 1 >>= (print :: String -> IO ())+ column sm 2 >>= (print :: String -> IO ())+ step sm+ column sm 0 >>= (print :: Int -> IO ())+ column sm 1 >>= (print :: String -> IO ())+ column sm 2 >>= (print :: String -> IO ())+ return ()
simplest-sqlite.cabal view
@@ -2,7 +2,7 @@ cabal-version: >= 1.8 name: simplest-sqlite-version: 0.0.0.14+version: 0.1.0.0 stability: Experimental author: YoshikuniJujo <PAF01143@nifty.ne.jp> maintainer: YoshikuniJujo <PAF01143@nifty.ne.jp>@@ -14,8 +14,11 @@ category: Database synopsis: Simplest SQLite3 binding description:- yet+ see sample code in samples/ +extra-source-files:+ samples/hello.hs+ source-repository head type: git location: git://github.com/YoshikuniJujo/test_haskell@@ -33,7 +36,7 @@ Database.SmplstSQLite3.Exception.Internal build-depends: base == 4.*, bytestring == 0.10.*, text >= 1.1 && < 1.3,- exception-hierarchy == 0.0.0.*, template-haskell >= 2.9 && < 2.11+ exception-hierarchy == 0.1.0.*, template-haskell >= 2.12 && < 2.14 ghc-options: -Wall -fno-warn-tabs extra-libraries: sqlite3 extensions: ForeignFunctionInterface
src/Database/SmplstSQLite3.hs view
@@ -8,7 +8,6 @@ SQLite, Stmt, Result(..), Type(..), SQLiteException(..), ) where -import Control.Applicative import Control.Monad import Control.Exception import qualified Data.ByteString as BS
src/Database/SmplstSQLite3/Templates.hs view
@@ -2,18 +2,20 @@ module Database.SmplstSQLite3.Templates (newException, mkSqliteThrow) where -import Control.Applicative import Control.Exception import Data.Typeable import Data.Char import Language.Haskell.TH import Foreign.C.Types +myNotStrict :: Q Strict+myNotStrict = bang noSourceUnpackedness noSourceStrictness+ newException :: String -> DecQ newException e =- newtypeD (cxt []) (mkName e) []- (normalC (mkName e) [strictType notStrict (conT ''String)])- [''Typeable, ''Show]+ newtypeD (cxt []) (mkName e) [] Nothing+ (normalC (mkName e) [bangType myNotStrict (conT ''String)]) [+ derivClause Nothing [conT ''Typeable, conT ''Show] ] sqliteThrowType :: DecQ sqliteThrowType = sigD (mkName "sqliteThrow") .