Merge pull request #106 from thiagorp/master
Add `FOR UPDATE SKIP LOCKED` to possible lock types and fix CI
This commit is contained in:
commit
5f98e7b253
@ -28,6 +28,7 @@ install:
|
|||||||
- stack --version
|
- stack --version
|
||||||
- echo "CREATE USER esqutest WITH PASSWORD 'esqutest';" | psql postgres
|
- echo "CREATE USER esqutest WITH PASSWORD 'esqutest';" | psql postgres
|
||||||
- createdb -O esqutest esqutest
|
- createdb -O esqutest esqutest
|
||||||
|
- mysql -e 'CREATE DATABASE esqutest;'
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- stack setup
|
- stack setup
|
||||||
|
|||||||
@ -829,6 +829,11 @@ data LockingKind =
|
|||||||
-- PostgreSQL.
|
-- PostgreSQL.
|
||||||
--
|
--
|
||||||
-- /Since: 2.2.7/
|
-- /Since: 2.2.7/
|
||||||
|
| ForUpdateSkipLocked
|
||||||
|
-- ^ @FOR UPDATE SKIP LOCKED@ syntax. Supported by MySQL, Oracle and
|
||||||
|
-- PostgreSQL.
|
||||||
|
--
|
||||||
|
-- /Since: 2.2.7/
|
||||||
| ForShare
|
| ForShare
|
||||||
-- ^ @FOR SHARE@ syntax. Supported by PostgreSQL.
|
-- ^ @FOR SHARE@ syntax. Supported by PostgreSQL.
|
||||||
--
|
--
|
||||||
|
|||||||
@ -1212,9 +1212,10 @@ makeLimit (conn, _) (Limit ml mo) orderByClauses =
|
|||||||
makeLocking :: LockingClause -> (TLB.Builder, [PersistValue])
|
makeLocking :: LockingClause -> (TLB.Builder, [PersistValue])
|
||||||
makeLocking = flip (,) [] . maybe mempty toTLB . Monoid.getLast
|
makeLocking = flip (,) [] . maybe mempty toTLB . Monoid.getLast
|
||||||
where
|
where
|
||||||
toTLB ForUpdate = "\nFOR UPDATE"
|
toTLB ForUpdate = "\nFOR UPDATE"
|
||||||
toTLB ForShare = "\nFOR SHARE"
|
toTLB ForUpdateSkipLocked = "\nFOR UPDATE SKIP LOCKED"
|
||||||
toTLB LockInShareMode = "\nLOCK IN SHARE MODE"
|
toTLB ForShare = "\nFOR SHARE"
|
||||||
|
toTLB LockInShareMode = "\nLOCK IN SHARE MODE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1337,9 +1337,10 @@ testLocking withConn = do
|
|||||||
let expected = complex <> "\n" <> syntax
|
let expected = complex <> "\n" <> syntax
|
||||||
(with1, with2, with3) `shouldBe` (expected, expected, expected)
|
(with1, with2, with3) `shouldBe` (expected, expected, expected)
|
||||||
|
|
||||||
it "looks sane for ForUpdate" $ sanityCheck ForUpdate "FOR UPDATE"
|
it "looks sane for ForUpdate" $ sanityCheck ForUpdate "FOR UPDATE"
|
||||||
it "looks sane for ForShare" $ sanityCheck ForShare "FOR SHARE"
|
it "looks sane for ForUpdateSkipLocked" $ sanityCheck ForUpdateSkipLocked "FOR UPDATE SKIP LOCKED"
|
||||||
it "looks sane for LockInShareMode" $ sanityCheck LockInShareMode "LOCK IN SHARE MODE"
|
it "looks sane for ForShare" $ sanityCheck ForShare "FOR SHARE"
|
||||||
|
it "looks sane for LockInShareMode" $ sanityCheck LockInShareMode "LOCK IN SHARE MODE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -212,7 +212,7 @@ withConn =
|
|||||||
R.runResourceT .
|
R.runResourceT .
|
||||||
withMySQLConn defaultConnectInfo
|
withMySQLConn defaultConnectInfo
|
||||||
{ connectHost = "localhost"
|
{ connectHost = "localhost"
|
||||||
, connectUser = "esqutest"
|
, connectUser = "travis"
|
||||||
, connectPassword = "esqutest"
|
, connectPassword = ""
|
||||||
, connectDatabase = "esqutest"
|
, connectDatabase = "esqutest"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user