simplest-sqlite 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+20/−9 lines, 2 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- samples/hello.hs +17/−6
- simplest-sqlite.cabal +3/−3
samples/hello.hs view
@@ -1,23 +1,34 @@+{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}++import Control.Monad import Database.SmplstSQLite3 main :: IO () main = withSQLite "test.sqlite3" $ \db -> do--- withPrepared db "CREATE TABLE greeting(id, words, greetee)" step >>= print- withPrepared db+ (n, _) <- withPrepared db (+ "SELECT count(*) FROM sqlite_master " +++ "WHERE type='table' and name='greeting'" ) $ \sm -> do+ _ <- step sm+ column sm 0 :: IO Int+ when (n == 0) $ do+ _ <- withPrepared db+ "CREATE TABLE greeting(id, words, greetee)" step+ return ()+ _ <- withPrepared db "INSERT INTO greeting VALUES(?, ?, 'world')" $ \sm -> do bindN sm 1 (155 :: Int) bindN sm 2 "good-bye"- step sm+ _ <- step sm reset sm bindN sm 1 (222 :: Int) bindN sm 2 "hoge" step sm- withPrepared db "SELECT * FROM greeting" $ \sm -> do- 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+ _ <- step sm column sm 0 >>= (print :: Int -> IO ()) column sm 1 >>= (print :: String -> IO ()) column sm 2 >>= (print :: String -> IO ())
simplest-sqlite.cabal view
@@ -2,7 +2,7 @@ cabal-version: >= 1.8 name: simplest-sqlite-version: 0.1.0.0+version: 0.1.0.1 stability: Experimental author: YoshikuniJujo <PAF01143@nifty.ne.jp> maintainer: YoshikuniJujo <PAF01143@nifty.ne.jp>@@ -26,7 +26,7 @@ source-repository this type: git location: git://github.com/YoshikuniJujo/test_haskell- tag: simplest-sqlite-0.0.0.14+ tag: simplest-sqlite-0.1.0.1 library hs-source-dirs: src@@ -36,7 +36,7 @@ Database.SmplstSQLite3.Exception.Internal build-depends: base == 4.*, bytestring == 0.10.*, text >= 1.1 && < 1.3,- exception-hierarchy == 0.1.0.*, template-haskell >= 2.12 && < 2.14+ exception-hierarchy == 0.1.0.*, template-haskell >= 2.12 && < 2.15 ghc-options: -Wall -fno-warn-tabs extra-libraries: sqlite3 extensions: ForeignFunctionInterface