我不确定这是否 100% 正确,但这是我能做的最好的。你自己看。
type
THackCustomClientDataSet = class(TCustomClientDataSet);
function IsBlobFetched(DataSet: TCustomClientDataSet; BlobField: TField): Boolean;
var
I: Integer;
Status: DBResult;
BlobLen: Cardinal;
begin
Result := False;
BlobLen := 0;
with THackCustomClientDataSet(DataSet) do
if Assigned(DSCursor) and (ActiveBuffer <> nil) then
begin
Status := DSCursor.GetBlobLen(ActiveBuffer, BlobField.FieldNo, BlobLen);
case Status of
DBERR_NONE:
Result := True;
DBERR_BLOBNOTFETCHED:
;
else
Check(Status);
end;
end;
end;
如果尚未获取 blob,则似乎在要返回的单元中DBERR_BLOBNOTFETCHED
定义。因此,返回代码表示“未获取 blob”,成功返回代码表示“已获取 blob”,任何其他错误代码都可能表示其他错误。灵感来自.DSIntf
GetBlobLen
TCustomClientDataSet.CreateBlobStream