mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-11-22 01:52:45 +03:00
Simplify
This commit is contained in:
parent
24b84452ea
commit
e366b3feba
@ -78,10 +78,7 @@ getPreparedStatementKey connection registry template oidList =
|
||||
PreparedStatementRegistry.update localKey onNewRemoteKey onOldRemoteKey registry
|
||||
where
|
||||
localKey =
|
||||
PreparedStatementRegistry.LocalKey template wordOIDList
|
||||
where
|
||||
wordOIDList =
|
||||
map (\(LibPQ.Oid x) -> fromIntegral x) oidList
|
||||
PreparedStatementRegistry.LocalKey template oidList
|
||||
onNewRemoteKey key =
|
||||
do
|
||||
sent <- LibPQ.sendPrepare connection key template (mfilter (not . null) (Just oidList))
|
||||
|
@ -9,6 +9,7 @@ where
|
||||
import ByteString.StrictBuilder qualified as B
|
||||
import Data.HashTable.IO qualified as A
|
||||
import Hasql.Prelude hiding (lookup)
|
||||
import qualified Database.PostgreSQL.LibPQ as Pq
|
||||
|
||||
data PreparedStatementRegistry
|
||||
= PreparedStatementRegistry !(A.BasicHashTable LocalKey ByteString) !(IORef Word)
|
||||
@ -44,7 +45,7 @@ update localKey onNewRemoteKey onOldRemoteKey (PreparedStatementRegistry table c
|
||||
-- |
|
||||
-- Local statement key.
|
||||
data LocalKey
|
||||
= LocalKey !ByteString ![Word32]
|
||||
= LocalKey !ByteString ![Pq.Oid]
|
||||
deriving (Show, Eq)
|
||||
|
||||
instance Hashable LocalKey where
|
||||
|
Loading…
Reference in New Issue
Block a user