DIOCP组件(Delphi IOCP)代码阅读之ADO内存表
DIOCP组件(Delphi IOCP)代码阅读之ADO内存表
代码中有
class procedure TADOTools.loadFromStream(pvDataSet: TCustomADODataSet;
pvStream: TStream);
var
AR:_Recordset;
begin
AR:=_Recordset(CoRecordset.Create);
pvStream.Position:=0;
AR.Open(TStreamAdapter.Create(pvStream) as IUnknown, EmptyParam,adOpenUnspecified, adLockUnspecified, -1);
pvDataSet.Recordset:=ADOInt._Recordset(AR);
end;
其中的TStreamAdapter是一个接口,可以匹配一个流,这个例子就用的内存流,将其直接赋值给了AdoQuery的内部流。
代码
constructor TStreamAdapter.Create(Stream: TStream;
Ownership: TStreamOwnership);
begin
inherited Create;
FStream := Stream;
FOwnership := Ownership;
end;
posted on 2014-02-28 18:09 stevenlaz 阅读(1208) 评论(1) 编辑 收藏 举报