@@ -336,9 +336,9 @@ BOOST_AUTO_TEST_CASE(descriptorMetadataFields)
336336 BOOST_CHECK (inDescriptors[0 ].alias .empty ());
337337}
338338
339- BOOST_AUTO_TEST_CASE (getOutputMessageMatchesMetadataLength )
339+ BOOST_AUTO_TEST_CASE (getOutputMessageContainsFetchedValueAtMetadataOffset )
340340{
341- const auto database = getTempFile (" Statement-getOutputMessageMatchesMetadataLength .fdb" );
341+ const auto database = getTempFile (" Statement-getOutputMessageContainsFetchedValueAtMetadataOffset .fdb" );
342342
343343 Attachment attachment{CLIENT , database, AttachmentOptions ().setCreateDatabase (true )};
344344 FbDropDatabase attachmentDrop{attachment};
@@ -349,12 +349,17 @@ BOOST_AUTO_TEST_CASE(getOutputMessageMatchesMetadataLength)
349349 auto & outMsg = stmt.getOutputMessage ();
350350 BOOST_CHECK (!outMsg.empty ());
351351
352- // After fetch, the output message buffer contains the fetched data.
352+ auto outMetadata = stmt.getOutputMetadata ();
353+ FbUniquePtr<fb::IStatus> tempStatus{CLIENT .newStatus ()};
354+ impl::StatusWrapper tempWrapper{CLIENT , tempStatus.get ()};
355+ const auto valueOffset = outMetadata->getOffset (&tempWrapper, 0u );
356+
353357 BOOST_REQUIRE (stmt.execute (transaction));
354358 BOOST_CHECK_EQUAL (stmt.getInt32 (0 ).value (), 42 );
355359
356- // The buffer reference should remain the same object.
357- BOOST_CHECK_EQUAL (&outMsg, &stmt.getOutputMessage ());
360+ BOOST_REQUIRE_GE (outMsg.size (), valueOffset + sizeof (std::int32_t ));
361+ const auto * data = &outMsg[valueOffset];
362+ BOOST_CHECK_EQUAL (*reinterpret_cast <const std::int32_t *>(data), 42 );
358363}
359364
360365BOOST_AUTO_TEST_SUITE_END ()
0 commit comments