Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi IBX:向TIBControlAndQueryService.InternalServiceQuery添加超时_Delphi_Delphi 2007_Interbase - Fatal编程技术网

Delphi IBX:向TIBControlAndQueryService.InternalServiceQuery添加超时

Delphi IBX:向TIBControlAndQueryService.InternalServiceQuery添加超时,delphi,delphi-2007,interbase,Delphi,Delphi 2007,Interbase,我想在调用TIBControlAndQueryServiceGetNextLine时添加isc_info_svc_timeout(1秒)选项。我复制并修改了IBServices,以便在isc_info_svc_行之后将isc_info_svc_timeout附加到ServiceQueryParams,类似于ServiceStartAddParam(Value:Integer;param:Integer)那样,但我收到错误消息“功能不受支持” 编辑 首先,我决定将超时添加到InternalServ

我想在调用TIBControlAndQueryServiceGetNextLine时添加isc_info_svc_timeout(1秒)选项。我复制并修改了IBServices,以便在isc_info_svc_行之后将isc_info_svc_timeout附加到ServiceQueryParams,类似于ServiceStartAddParam(Value:Integer;param:Integer)那样,但我收到错误消息“功能不受支持”

编辑

首先,我决定将超时添加到InternalServiceQuery而不是GetNextLine。第二,我将timeout参数附加到FQueryParams,我不应该这样做。第三,超时参数在isc_服务_查询函数中有自己的位置,即4和5位置(数据长度和数据指针)。现在它看起来可以工作了,我的意思是没有“功能不受支持”的错误,但不幸的是它没有。在调用GetNextLine(调用InternalServiceQuery)后,如果没有数据要发回,我的应用程序将挂起并等待数据,如timeout参数无效

procedure TIBCustomService.InternalServiceQuery;

  function AddParam (Value: Integer; param: Integer): string;
  begin
  Result  := Char(Param) +
         PChar(@Value)[0] +
         PChar(@Value)[1] +
         PChar(@Value)[2] +
         PChar(@Value)[3];
  end;

var
  FTimeout: string;
  PTimeout: PChar;
  FTimeoutLen: short;
begin
  FTimeout := AddParam(1, isc_info_svc_timeout);
  FTimeoutLen := Length(FTimeout);
  PTimeout := nil;
  IBAlloc(PTimeout, 0, FTimeoutLen);
  Move(FTimeout[1], PTimeout[0], FTimeoutLen);

  FQuerySPBLength := Length(FQueryParams);
  if FQuerySPBLength = 0 then
    IBError(ibxeQueryParamsError, [nil]);
  IBAlloc(FQuerySPB, 0, FQuerySPBLength);
  Move(FQueryParams[1], FQuerySPB[0], FQuerySPBLength);
  if (FOutputBuffer = nil) then
    IBAlloc(FOutputBuffer, 0, FBufferSize);
  try
  if call(FGDSLibrary.isc_service_query(StatusVector, @FHandle, nil,
               FTimeoutLen, PTimeout,
               FQuerySPBLength, FQuerySPB,
               FBufferSize, FOutputBuffer), False) > 0 then
  begin