@@ -325,9 +325,9 @@ BOOST_AUTO_TEST_CASE(descriptorMetadataFields)
325325 BOOST_CHECK (inDescriptors[0 ].alias .empty ());
326326}
327327
328- BOOST_AUTO_TEST_CASE (getOutputMessageMatchesMetadataLength )
328+ BOOST_AUTO_TEST_CASE (getOutputMessageContainsFetchedValueAtMetadataOffset )
329329{
330- const auto database = getTempFile (" Statement-getOutputMessageMatchesMetadataLength .fdb" );
330+ const auto database = getTempFile (" Statement-getOutputMessageContainsFetchedValueAtMetadataOffset .fdb" );
331331
332332 Attachment attachment{CLIENT , database, AttachmentOptions ().setCreateDatabase (true )};
333333 FbDropDatabase attachmentDrop{attachment};
@@ -338,12 +338,17 @@ BOOST_AUTO_TEST_CASE(getOutputMessageMatchesMetadataLength)
338338 auto & outMsg = stmt.getOutputMessage ();
339339 BOOST_CHECK (!outMsg.empty ());
340340
341- // After fetch, the output message buffer contains the fetched data.
341+ auto outMetadata = stmt.getOutputMetadata ();
342+ FbUniquePtr<fb::IStatus> tempStatus{CLIENT .newStatus ()};
343+ impl::StatusWrapper tempWrapper{CLIENT , tempStatus.get ()};
344+ const auto valueOffset = outMetadata->getOffset (&tempWrapper, 0u );
345+
342346 BOOST_REQUIRE (stmt.execute (transaction));
343347 BOOST_CHECK_EQUAL (stmt.getInt32 (0 ).value (), 42 );
344348
345- // The buffer reference should remain the same object.
346- BOOST_CHECK_EQUAL (&outMsg, &stmt.getOutputMessage ());
349+ BOOST_REQUIRE_GE (outMsg.size (), valueOffset + sizeof (std::int32_t ));
350+ const auto * data = &outMsg[valueOffset];
351+ BOOST_CHECK_EQUAL (*reinterpret_cast <const std::int32_t *>(data), 42 );
347352}
348353
349354BOOST_AUTO_TEST_SUITE_END ()
0 commit comments