Вы можете начать свое исследование со следующего модуля:
unit BlobFld; interface usesSysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,Forms, Dialogs, StdCtrls, Buttons, DBTables, DB, ExtCtrls, DBCtrls,Grids, DBGrids; typeTFrmBlobFld = class(TForm)BtnWrite: TBitBtn;Table1: TTable;DataSource1: TDataSource;DBNavigator1: TDBNavigator;LbxDisplayBlob: TListBox;Table1pubid: TIntegerField;Table1comments: TMemoField;Table1UpdateTime: TTimeField;Table1Real1: TFloatField;Table1Real2: TFloatField;Table1Real3: TFloatField;Table1Curr1: TCurrencyField;Table1Blobs: TBlobField;Table1Bytes: TBytesField;CbxRead: TCheckBox;procedure BtnWriteClick(Sender: TObject);procedure DataSource1DataChange(Sender: TObject; Field: TField);procedure FormShow(Sender: TObject);procedure FormClose(Sender: TObject; var Action: TCloseAction);private{ Private-Deklarationen }public{ Public-Deklarationen }end; varFrmBlobFld: TFrmBlobFld; implementation {$R *.DFM} typeADouble = array[1..12] of double;PADouble = ^ADouble; procedure TFrmBlobFld.BtnWriteClick(Sender: TObject);vari: integer;myBlob: TBlobStream;v: longint;beginTable1.Edit; myBlob := TBlobStream.Create(Table1Blobs, bmReadWrite);tryv := ComponentCount;myBlob.Write(v, sizeof(longint)); for i := 0 to ComponentCount - 1 do beginv := Components[i].ComponentIndex;myBlob.Write(v, sizeof(longint));end;finally Table1.Post;myBlob.Free;end;end; procedure TFrmBlobFld.DataSource1DataChange(Sender: TObject; Field: TField);vari: integer;myBlob: TBlobStream;t: longint;v: longint;beginif CbxRead.Checked then beginLbxDisplayBlob.Clear; myBlob := TBlobStream.Create(Table1Blobs, bmRead);trymyBlob.Read(t, sizeof(longint));LbxDisplayBlob.Items.Add(IntToStr(t)); for i := 0 to t - 1 do beginmyBlob.Read(v, sizeof(longint));LbxDisplayBlob.Items.Add(IntToStr(v));end;finallymyBlob.Free;end;end;end; procedure TFrmBlobFld.FormShow(Sender: TObject);beginTable1.Open;end; procedure TFrmBlobFld.FormClose(Sender: TObject;var Action: TCloseAction);beginTable1.Close;end; end. |
- Ralph Friedman [000978]