Repository navigation
update to sqlite-simple 0.4.19.0 - #7
Closed
evgeny-simplex wants to merge 25 commits into
Closed
evgeny-simplex wants to merge 25 commits into
evgeny-simplex wants to merge 25 commits into
Conversation
This reverts commit 016f02b.
…onfig-fix-warnings Add github actions CI config, improve tests, fix few typos and hlint warnings
Since Ok can store any exception in makes no reason to erase type of exception and convert it to ErrorCall This also makes MonadThrow instance not conditional on existence of MonadFail instances
This appeases the -Wnoncanonical-monad-instances warning. This warning exists because a future GHC release may treat noncanonical definitions as errors. See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return
Added queryNamedWith, foldWith, foldWith_, and foldNamedWith --------- Co-authored-by: Tristan Mc Leay <tristan@cassowary.org>
Author
|
diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml
remerge CONFLICT (add/add): Merge conflict in .github/workflows/haskell-ci.yml
index 70b7084..d17436d 100644
--- a/.github/workflows/haskell-ci.yml
+++ b/.github/workflows/haskell-ci.yml
@@ -1,10 +1,6 @@
# This GitHub workflow config has been generated by a script via
#
-<<<<<<< 2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3))
# haskell-ci '--distribution' 'noble' 'github' 'sqlcipher-simple.cabal'
-=======
-# haskell-ci '--distribution' 'noble' 'github' 'sqlite-simple.cabal'
->>>>>>> 2b7b708 (Added 'With' tests)
#
# To regenerate the script (for example after adjusting tested-with) run
#
@@ -14,11 +10,7 @@
#
# version: 0.19.20250506
#
-<<<<<<< 2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3))
# REGENDATA ("0.19.20250506",["--distribution","noble","github","sqlcipher-simple.cabal"])
-=======
-# REGENDATA ("0.19.20250506",["--distribution","noble","github","sqlite-simple.cabal"])
->>>>>>> 2b7b708 (Added 'With' tests)
#
name: Haskell-CI
on:
@@ -179,7 +171,6 @@ jobs:
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
- name: generate cabal.project
run: |
-<<<<<<< 2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3))
PKGDIR_sqlcipher_simple="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/sqlcipher-simple-[0-9.]*')"
echo "PKGDIR_sqlcipher_simple=${PKGDIR_sqlcipher_simple}" >> "$GITHUB_ENV"
rm -f cabal.project cabal.project.local
@@ -195,19 +186,6 @@ jobs:
tag: 2330df3dc8c4b660674d3c02d76bb86f66c2abee
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(sqlcipher-simple)$/; }' >> cabal.project.local
-=======
- PKGDIR_sqlite_simple="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/sqlite-simple-[0-9.]*')"
- echo "PKGDIR_sqlite_simple=${PKGDIR_sqlite_simple}" >> "$GITHUB_ENV"
- rm -f cabal.project cabal.project.local
- touch cabal.project
- touch cabal.project.local
- echo "packages: ${PKGDIR_sqlite_simple}" >> cabal.project
- echo "package sqlite-simple" >> cabal.project
- echo " ghc-options: -Werror=missing-methods" >> cabal.project
- cat >> cabal.project <<EOF
- EOF
- $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(sqlite-simple)$/; }' >> cabal.project.local
->>>>>>> 2b7b708 (Added 'With' tests)
cat cabal.project
cat cabal.project.local
- name: dump install plan
@@ -235,11 +213,7 @@ jobs:
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
- name: cabal check
run: |
-<<<<<<< 2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3))
cd ${PKGDIR_sqlcipher_simple} || false
-=======
- cd ${PKGDIR_sqlite_simple} || false
->>>>>>> 2b7b708 (Added 'With' tests)
${CABAL} -vnormal check
- name: haddock
run: |
diff --git a/.gitignore b/.gitignore
remerge CONFLICT (content): Merge conflict in .gitignore
index 89d4369..b618340 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,4 @@
-<<<<<<< 2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3))
-cabal-dev/
-dist/
-TAGS
-/*.hs.html
-/hpc_*.html
-/test.tix
-.stack-work/
-dist-newstyle/
-=======
/dist-newstyle/
/.stack-work/
/stack.yaml.lock
/stack-*.yaml.lock
->>>>>>> 2b7b708 (Added 'With' tests)
diff --git a/Database/SQLite/Simple/FromField.hs b/Database/SQLite/Simple/FromField.hs
index 5ade933..ca9f0d8 100644
--- a/Database/SQLite/Simple/FromField.hs
+++ b/Database/SQLite/Simple/FromField.hs
@@ -159,16 +159,17 @@ instance FromField Bool where
fromField f = returnError ConversionFailed f "expecting an SQLInteger column type"
instance FromField T.Text where
- fromField (Field (SQLText txt) _) = Ok txt
- fromField f = returnError ConversionFailed f "need a text"
+ fromField f@(Field sqlData _) = case sqlData of
+ SQLText v -> Ok v
+ SQLInteger v -> Ok $ T.pack $ show v
+ SQLFloat v -> Ok $ T.pack $ show v
+ _ -> returnError ConversionFailed f "need convertible to text"
instance FromField LT.Text where
- fromField (Field (SQLText txt) _) = Ok . LT.fromStrict $ txt
- fromField f = returnError ConversionFailed f "need a text"
+ fromField f = LT.fromStrict <$> fromField f
instance FromField [Char] where
- fromField (Field (SQLText t) _) = Ok $ T.unpack t
- fromField f = returnError ConversionFailed f "expecting SQLText column type"
+ fromField f = T.unpack <$> fromField f
instance FromField ByteString where
fromField (Field (SQLBlob blb) _) = Ok blb
diff --git a/sqlcipher-simple.cabal b/sqlcipher-simple.cabal
remerge CONFLICT (content): Merge conflict in sqlcipher-simple.cabal
index b8c2e95..2a4641e 100644
--- a/sqlcipher-simple.cabal
+++ b/sqlcipher-simple.cabal
@@ -1,10 +1,5 @@
-<<<<<<< 2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3)):sqlcipher-simple.cabal
Name: sqlcipher-simple
-Version: 0.4.18.1
-=======
-Name: sqlite-simple
Version: 0.4.19.0
->>>>>>> 2b7b708 (Added 'With' tests):sqlite-simple.cabal
Synopsis: Mid-Level SQLite client library
Description:
Mid-level SQLCipher client library, forked from sqlite-simple.
@@ -21,14 +16,9 @@ Maintainer: Evgeny Poberezkin <ep@simplex.chat>
Copyright: (c) 2011 MailRank, Inc.,
(c) 2011-2012 Leon P Smith,
(c) 2012-2014 Janne Hellsten
-<<<<<<< 2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3)):sqlcipher-simple.cabal
+ (c) 2022-2026 Joshua Chia
Homepage: https://github.com/simplex-chat/sqlcipher-simple
bug-reports: https://github.com/simplex-chat/sqlcipher-simple/issues
-=======
- (c) 2022-2026 Joshua Chia
-Homepage: http://github.com/nurpax/sqlite-simple
-bug-reports: http://github.com/nurpax/sqlite-simple/issues
->>>>>>> 2b7b708 (Added 'With' tests):sqlite-simple.cabal
Stability: stable
Category: Database
Build-type: Simple
diff --git a/stack.yaml b/stack.yaml
deleted file mode 120000
remerge CONFLICT (distinct types): stack.yaml had different types on each side; renamed one of them so each can be recorded somewhere.
index 3610612..0000000
--- a/stack.yaml
+++ /dev/null
@@ -1 +0,0 @@
-stack-9.10.yaml
\ No newline at end of file
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
remerge CONFLICT (distinct types): stack.yaml had different types on each side; renamed one of them so each can be recorded somewhere.
index 0000000..a482ea3
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,12 @@
+resolver: lts-15.1 # 8.8.2 - base-4.13
+# resolver: lts-14.27 # 8.6.5 - base-4.12
+# resolver: lts-12.26 # 8.4.4 - base-4.11
+# resolver: lts-11.22 # 8.2.2 - base-4.10
+# resolver: lts-9.21 # 8.0.2 - base-4.9
+# resolver: lts-6.35 # 7.10.3 - base-4.8
+
+extra-deps:
+ # - direct-sqlcipher-2.3.26
+ # - ../direct-sqlcipher
+ - github: simplex-chat/direct-sqlcipher
+ commit: 34309410eb2069b029b8fc1872deb1e0db123294
diff --git a/stack.yaml~2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3)) b/stack.yaml~2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3))
deleted file mode 100644
index a482ea3..0000000
--- a/stack.yaml~2b8c18c (ci: haskell-ci workflow for sqlcipher-simple (#3))
+++ /dev/null
@@ -1,12 +0,0 @@
-resolver: lts-15.1 # 8.8.2 - base-4.13
-# resolver: lts-14.27 # 8.6.5 - base-4.12
-# resolver: lts-12.26 # 8.4.4 - base-4.11
-# resolver: lts-11.22 # 8.2.2 - base-4.10
-# resolver: lts-9.21 # 8.0.2 - base-4.9
-# resolver: lts-6.35 # 7.10.3 - base-4.8
-
-extra-deps:
- # - direct-sqlcipher-2.3.26
- # - ../direct-sqlcipher
- - github: simplex-chat/direct-sqlcipher
- commit: 34309410eb2069b029b8fc1872deb1e0db123294
diff --git a/test/Errors.hs b/test/Errors.hs
index 40ab7a4..80821d6 100644
--- a/test/Errors.hs
+++ b/test/Errors.hs
@@ -67,7 +67,7 @@ testErrorsColumns TestEnv{..} = TestCase $ do
}
-- Mismatching types (source int,text doesn't match dst string,int)
assertResultErrorThrown (query_ conn "SELECT id, t FROM cols" :: IO [(String, Int)])
- ConversionFailed {errSQLType = "INTEGER", errHaskellType = "[Char]", errMessage = "expecting SQLText column type"}
+ ConversionFailed {errSQLType = "TEXT", errHaskellType = "Int", errMessage = "need an int"}
-- Mismatching types (source string doesn't match dst integer)
assertResultErrorThrown (query_ conn "SELECT 'foo'" :: IO [Only Integer])
ConversionFailed {errSQLType = "TEXT", errHaskellType = "Integer", errMessage = "need an int"}
@@ -85,15 +85,8 @@ testErrorsColumns TestEnv{..} = TestCase $ do
ConversionFailed {errSQLType = "TEXT", errHaskellType = "Bool", errMessage = "expecting an SQLInteger column type"}
assertResultErrorThrown (query_ conn "SELECT 2" :: IO [Only Bool])
ConversionFailed {errSQLType = "INTEGER", errHaskellType = "Bool", errMessage = "bool must be 0 or 1, got 2"}
- -- Mismatching types (sources don't match destination string types (text, string)
- assertResultErrorThrown (query_ conn "SELECT 1" :: IO [Only T.Text])
- ConversionFailed {errSQLType = "INTEGER", errHaskellType = "Text", errMessage = "need a text"}
- assertResultErrorThrown (query_ conn "SELECT 1" :: IO [Only LT.Text])
- ConversionFailed {errSQLType = "INTEGER", errHaskellType = "Text", errMessage = "need a text"}
- assertResultErrorThrown (query_ conn "SELECT 1.0" :: IO [Only T.Text])
- ConversionFailed {errSQLType = "FLOAT", errHaskellType = "Text", errMessage = "need a text"}
- assertResultErrorThrown (query_ conn "SELECT 1.0" :: IO [Only LT.Text])
- ConversionFailed {errSQLType = "FLOAT", errHaskellType = "Text", errMessage = "need a text"}
+ numbers <- query_ conn "SELECT 1, 1.0" :: IO [(T.Text, LT.Text)]
+ [("1", "1.0")] @=? numbers
-- Mismatching types (sources don't match destination string types (time/date)
assertResultErrorThrown (query_ conn "SELECT 1" :: IO [Only UTCTime])
ConversionFailed {errSQLType = "INTEGER", errHaskellType = "UTCTime", errMessage = "expecting SQLText column type"}
@@ -116,7 +109,7 @@ testErrorsColumns TestEnv{..} = TestCase $ do
assertResultErrorThrown
(do [Only _t1] <- query conn "SELECT b FROM cols_blobs WHERE id = ?" (Only (1 :: Int)) :: IO [Only String]
return ())
- ConversionFailed {errSQLType = "BLOB", errHaskellType = "[Char]", errMessage = "expecting SQLText column type"}
+ ConversionFailed {errSQLType = "BLOB", errHaskellType = "Text", errMessage = "need convertible to text"}
execute_ conn "CREATE TABLE cols_bools (id INTEGER PRIMARY KEY, b BOOLEAN)"
-- 3 = invalid value for bool, must be 0 or 1
execute_ conn "INSERT INTO cols_bools (b) VALUES (3)"
diff --git a/test/With.hs b/test/With.hs
index 43a8cc3..b704fd7 100644
--- a/test/With.hs
+++ b/test/With.hs
@@ -119,7 +119,7 @@ expectedTypeError =
ConversionFailed
{ errSQLType = "NULL"
, errHaskellType = "Text"
- , errMessage = "need a text"
+ , errMessage = "need convertible to text"
}
mkTest :: AccessMode -> BindingMode -> Table -> PathKind -> TestEnv -> Test |
This was referenced Nov 19, 2026
Author
|
Replaced by #8, whose merge commit resolves only the conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merges master (nurpax/sqlite-simple 2b7b708, 0.4.19.0) into sqlcipher; one merge commit, 00292a3.
GitHub shows a merge commit as its diff from the first parent; the resolutions alone (
git show --remerge-diff 00292a3) are in the first comment.Merge with a merge commit, so that master stays an ancestor of sqlcipher.