This commit is contained in:
Nikita Volkov 2024-04-21 07:56:16 +03:00
parent 24b84452ea
commit e366b3feba
2 changed files with 3 additions and 5 deletions

View File

@ -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))

View File

@ -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