unit
  FRM_IBOQuery;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Mask, ExtCtrls, StdCtrls, Grids, Buttons,

  IB_Session,
  IB_Components,
  IB_Script,
  IB_Process,
  IB_Grid,
  IB_Controls,
  IB_LocateEdit,
  IB_NavigationBar,
  IB_DatasetBar,
  IB_UpdateBar,
  IB_SearchBar,
  IB_Samples,

  DB,
  DBGrids,
  IBODataset;

type
  TfrmBlobInserts = class(TForm)
    cn: TIB_Connection;
    tr: TIB_Transaction;
    qr: TIBOQuery;
    ds: TDataSource;
    IB_Grid1: TDBGrid;
    Panel1: TPanel;
    sbFiltered: TSpeedButton;
    btFindFirst: TButton;
    btFindNext: TButton;
    btFindPrior: TButton;
    btFindLast: TButton;
    btIncTmpID: TButton;
    Memo1: TMemo;
    procedure sbFilteredClick(Sender: TObject);
    procedure btFindClick(Sender: TObject);
    procedure btIncTmpIDClick(Sender: TObject);
    procedure qrFilterRecord(DataSet: TDataSet; var Accept: Boolean);
    procedure qrBeforeOpen(DataSet: TDataSet);
    procedure FormCreate(Sender: TObject);
    procedure cnAfterConnect(Sender: TIB_Connection);
  private
    tmpID: integer;
  public
  end;

var
  frmBlobInserts: TfrmBlobInserts;

implementation

{$R *.DFM}

procedure TfrmBlobInserts.FormCreate(Sender: TObject);
begin
  ReadDefaultPath(cn,'BlobInsertsPath');
  qr.Open;
end;

procedure TfrmBlobInserts.cnAfterConnect(Sender: TIB_Connection);
begin
  WriteDefaultPath;
end;

procedure TfrmBlobInserts.qrBeforeOpen(DataSet: TDataSet);
begin
  tmpID := 4;
end;

procedure TfrmBlobInserts.qrFilterRecord(DataSet: TDataSet;
  var Accept: Boolean);
begin
//  Accept := qr.FieldByName( 'ID' ).AsInteger mod 5 = 3;
  Accept := qr.FieldByName( 'ID' ).AsInteger <> tmpID;
//  Accept := qr.FieldByName( 'STRING_FIELD' ).AsString = 'Some Stuff';
end;

procedure TfrmBlobInserts.sbFilteredClick(Sender: TObject);
begin
  qr.Filtered := sbFiltered.Down;
end;

procedure TfrmBlobInserts.btIncTmpIDClick(Sender: TObject);
begin
  Inc( tmpID );
  btIncTmpID.Caption := 'Inc( tmpID ) (' + IntToStr( tmpID ) + ')';
  qr.RefreshFilteredRows;
end;

procedure TfrmBlobInserts.btFindClick(Sender: TObject);
begin
  if Sender = btFindFirst then qr.FindFirst else
  if Sender = btFindNext  then qr.FindNext  else
  if Sender = btFindPrior then qr.FindPrior else
  if Sender = btFindLast  then qr.FindLast;
end;

end.


