module Pqi.Conformance.Operation.SendQueryParams
( spec,
)
where
import qualified Pqi
import qualified Pqi as Lq
import Pqi.Conformance.Harness
import Pqi.Conformance.Prelude
import Pqi.Conformance.Scenario (drainResults, int4Oid)
import Test.Hspec
spec :: Pqi.Adapter -> SpecWith ByteString
spec :: Adapter -> SpecWith ByteString
spec Adapter
adapter =
String -> SpecWith ByteString -> SpecWith ByteString
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"sendQueryParams" do
String
-> (ByteString -> IO ()) -> SpecWith (Arg (ByteString -> IO ()))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"sends a parameterized query and collects its result" \ByteString
conninfo ->
Adapter
-> ByteString
-> (Connection -> IO (Bool, [ResultObservation]))
-> IO ()
forall a.
(Eq a, Show a, HasCallStack) =>
Adapter -> ByteString -> (Connection -> IO a) -> IO ()
differential Adapter
adapter ByteString
conninfo \Connection
connection -> do
sent <-
Connection
-> ByteString
-> [Maybe (Word32, ByteString, Format)]
-> Format
-> IO Bool
Lq.sendQueryParams
Connection
connection
ByteString
"select $1 :: int4 + $2 :: int4, $3 :: text"
[(Word32, ByteString, Format) -> Maybe (Word32, ByteString, Format)
forall a. a -> Maybe a
Just (Word32
int4Oid, ByteString
"40", Format
Lq.Text), (Word32, ByteString, Format) -> Maybe (Word32, ByteString, Format)
forall a. a -> Maybe a
Just (Word32
int4Oid, ByteString
"2", Format
Lq.Text), Maybe (Word32, ByteString, Format)
forall a. Maybe a
Nothing]
Format
Lq.Text
results <- drainResults connection
pure (sent, results)