yeshql-postgresql-simple 4.1.0.1 → 4.1.0.2
raw patch · 3 files changed
+9/−1 lines, 3 files
Files
- src/Database/YeshQL/PostgreSQL.hs +2/−0
- tests/Database/YeshQL/PostgreSQL/Tests.hs +6/−0
- yeshql-postgresql-simple.cabal +1/−1
src/Database/YeshQL/PostgreSQL.hs view
@@ -36,6 +36,7 @@ import qualified Text.Parsec as P import Data.Char (chr, ord, toUpper, toLower) import Control.Applicative ( (<$>), (<*>) )+import Control.Monad (void) import System.FilePath (takeBaseName) import Data.Char (isAlpha, isAlphaNum) @@ -157,6 +158,7 @@ _ -> [| \qstr params conn -> PostgreSQL.query conn (fromString qstr) params |] ReturnTuple One tys -> case tys of+ [] -> [| \qstr params conn -> void (PostgreSQL.query conn (fromString qstr) params :: IO [[()]]) |] [t] -> [| \qstr params conn -> fmap (fmap fromOnly . headMay) (PostgreSQL.query conn (fromString qstr) params) |] _ -> [| \qstr params conn -> fmap headMay (PostgreSQL.query conn (fromString qstr) params) |] ReturnRecord Many _ ->
tests/Database/YeshQL/PostgreSQL/Tests.hs view
@@ -67,6 +67,12 @@ SELECT username FROM users|] conn return () +testEmptyReturn :: Connection -> TestTree+testEmptyReturn conn = testCase "Simple SELECT (empty return)" $ do+ [yesh|+ -- name:getUserByName :: ()+ SELECT username FROM users WHERE 0|] conn+ testSimpleSelectStr :: Connection -> TestTree testSimpleSelectStr conn = testCase "Simple SELECT (expr by string)" $ do results <- $(yesh $ unlines
yeshql-postgresql-simple.cabal view
@@ -1,5 +1,5 @@ name: yeshql-postgresql-simple-version: 4.1.0.1+version: 4.1.0.2 synopsis: YesQL-style SQL database abstraction (postgresql-simple backend) description: Use quasi-quotations or TemplateHaskell to write SQL in SQL, while adding type annotations to turn SQL into well-typed Haskell