program TrendViewer;

{$APPTYPE CONSOLE}

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FIBQuery, pFIBQuery, FIBDatabase, pFIBDatabase, StdCtrls,
  ExtCtrls, Buttons, TagViewer;

var
  db: TpFIBDatabase;
  trn: TpFIBTransaction;
  TagViewerForm: TTagViewerForm;
begin
  trn := TpFIBTransaction.Create(nil);
  db := TpFIBDatabase.Create(nil);

  db.DefaultTransaction := trn;
  trn.DefaultDatabase := db;

  db.DBParams.Add('lc_ctype=WIN1251');
  db.DBParams.Add('password=masterkey');
  db.DBParams.Add('user_name=SYSDBA');
  db.SQLDialect := 3;
  db.DBName := ParamStr(1);
  try
    db.Connected := true;

    TagViewerForm := TTagViewerForm.Create(nil);
    TagViewerForm.Readonly := ParamStr(3) = 'R';
    TagViewerForm.db := db;
    TagViewerForm.fname := ParamStr(2);
    TagViewerForm.Init;
    TagViewerForm.ShowModal;
  finally
    trn.Free;
    db.Free;
  end;  
end.
