Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/dsql/DsqlRequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,15 +595,20 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
JRD_receive(tdbb, request, message->msg_number, outMsgLength, outMsg);

// if this is a singleton select that return some data, make sure there's in fact one record

if (singleton && (request->req_flags & req_active) && outMsgLength > 0)
if (singleton && outMsgLength > 0)
{
// No record returned though expected
if (!(request->req_flags & req_active))
{
status_exception::raise(Arg::Gds(isc_stream_eof));
}

// Create a temp message buffer and try one more receive.
// If it succeed then the next record exists.

std::unique_ptr<UCHAR[]> message_buffer(new UCHAR[outMsgLength]);
HalfStaticArray<UCHAR, BUFFER_SMALL> message_buffer(getPool(), outMsgLength);

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

// Still active request means that second record exists
if ((request->req_flags & req_active))
Expand Down
Loading