@@ -596,19 +596,28 @@ void DsqlDmlRequest::doExecute(thread_db* tdbb, jrd_tra** traHandle,
596596
597597 // if this is a singleton select that return some data, make sure there's in fact one record
598598
599- if (singleton && (request-> req_flags & req_active) && outMsgLength > 0 )
599+ if (singleton)
600600 {
601- // Create a temp message buffer and try one more receive.
602- // If it succeed then the next record exists.
601+ if (outMsgLength > 0 )
602+ {
603+ // No record returned though expected
604+ if (!(request->req_flags & req_active))
605+ {
606+ status_exception::raise (Arg::Gds (isc_stream_eof));
607+ }
603608
604- std::unique_ptr<UCHAR[]> message_buffer (new UCHAR[outMsgLength]);
609+ // Create a temp message buffer and try one more receive.
610+ // If it succeed then the next record exists.
605611
606- JRD_receive (tdbb, request, message-> msg_number , outMsgLength, message_buffer. get () );
612+ std::unique_ptr<UCHAR[]> message_buffer ( new UCHAR[outMsgLength] );
607613
608- // Still active request means that second record exists
609- if ((request->req_flags & req_active))
610- {
611- status_exception::raise (Arg::Gds (isc_sing_select_err));
614+ JRD_receive (tdbb, request, message->msg_number , outMsgLength, message_buffer.get ());
615+
616+ // Still active request means that second record exists
617+ if ((request->req_flags & req_active))
618+ {
619+ status_exception::raise (Arg::Gds (isc_sing_select_err));
620+ }
612621 }
613622 }
614623 }
0 commit comments