Skip to content

Commit 3e9cf8d

Browse files
authored
Possible fix for #8734 (#8735)
* Possible fix for #8734 * Use explicit pool * Use HalfStaticArray as demanded * Use begin() instead of getBuffer() * Combine conditions as requested
1 parent 85ea945 commit 3e9cf8d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/dsql/DsqlRequests.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,15 +595,20 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
595595
JRD_receive(tdbb, request, message->msg_number, outMsgLength, outMsg);
596596

597597
// if this is a singleton select that return some data, make sure there's in fact one record
598-
599-
if (singleton && (request->req_flags & req_active) && outMsgLength > 0)
598+
if (singleton && outMsgLength > 0)
600599
{
600+
// No record returned though expected
601+
if (!(request->req_flags & req_active))
602+
{
603+
status_exception::raise(Arg::Gds(isc_stream_eof));
604+
}
605+
601606
// Create a temp message buffer and try one more receive.
602607
// If it succeed then the next record exists.
603608

604-
std::unique_ptr<UCHAR[]> message_buffer(new UCHAR[outMsgLength]);
609+
HalfStaticArray<UCHAR, BUFFER_SMALL> message_buffer(getPool(), outMsgLength);
605610

606-
JRD_receive(tdbb, request, message->msg_number, outMsgLength, message_buffer.get());
611+
JRD_receive(tdbb, request, message->msg_number, outMsgLength, message_buffer.begin());
607612

608613
// Still active request means that second record exists
609614
if ((request->req_flags & req_active))

0 commit comments

Comments
 (0)