Configure to use with DBISAM

What are the steps to configure OPB to work with DBISAM Tables?

Any Information will be appreciated.

Regards.

Comments

  • edited 12:17AM
    You have to write OQB engine for DBISAM. You can use bde, ado or ibx engines code as a sample.

    Here is a DBISAM engine code from FastReport powerpack, you may try to use it:

    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    StdCtrls, ExtCtrls, DB, DBISAMtb, QBuilder;


    type
    TfrQBDBIEngine = class(TOQBEngine)
    private
    FResultQuery: TDBISAMQuery;
    public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure ReadTableList; override;
    procedure ReadFieldList(ATableName: string); override;
    procedure ClearQuerySQL; override;
    procedure SetQuerySQL(Value: string); override;
    function ResultQuery: TDataSet; override;
    procedure OpenResultQuery; override;
    procedure CloseResultQuery; override;
    procedure SaveResultQueryData; override;
    function SelectDatabase: Boolean; override;
    procedure UpdateTableList;
    published
    property Query: TDBISAMQuery read FResultQuery write FResultQuery;
    end;


    { TfrQBDBIEngine }

    constructor TfrQBDBIEngine.Create(AOwner: TComponent);
    begin
    inherited Create(AOwner);
    FResultQuery := nil;
    end;

    destructor TfrQBDBIEngine.Destroy;
    begin
    CloseResultQuery;
    inherited Destroy;
    end;

    procedure TfrQBDBIEngine.UpdateTableList;
    begin
    ReadTableList;
    end;

    function TfrQBDBIEngine.SelectDatabase: Boolean;
    begin
    Result := False;
    end;

    procedure TfrQBDBIEngine.ReadTableList;
    begin
    Session.GetTableNames(DatabaseName, TableList);
    end;

    procedure TfrQBDBIEngine.ReadFieldList(ATableName: String);
    var
    i: Integer;
    Temp: TDBISAMTable;
    begin
    Temp := nil;
    try
    Temp := TDBISAMTable.Create(nil);
    Temp.DataBaseName := FResultQuery.DatabaseName;
    Temp.TableName := aTableName;

    FieldList.Clear;
    FieldList.Add('*');
    Temp.FieldDefs.Update;
    for i := 0 to Temp.FieldDefs.Count - 1 do
    FieldList.Add(Temp.FieldDefs.Items.Name);
    finally
    Temp.Close;
    Temp.Free;
    end;
    end;

    procedure TfrQBDBIEngine.ClearQuerySQL;
    begin
    FResultQuery.SQL.Clear;
    end;

    procedure TfrQBDBIEngine.SetQuerySQL(Value: String);
    begin
    FResultQuery.SQL.Text := Value;
    end;

    function TfrQBDBIEngine.ResultQuery: TDataSet;
    begin
    Result := FResultQuery;
    end;

    procedure TfrQBDBIEngine.OpenResultQuery;
    begin
    if not FResultQuery.Prepared then
    FResultQuery.Prepare;
    FResultQuery.Active := True;
    end;

    procedure TfrQBDBIEngine.CloseResultQuery;
    begin
    FResultQuery.Active := False;
    end;

    procedure TfrQBDBIEngine.SaveResultQueryData;
    begin
    ShowMessage('Operation non supported.');
    end;
  • edited 12:17AM
    Alex,

    Thanks for your help.... I'll try it.

    Regards.
  • edited 12:17AM
    Hi All,

    I am running with D6.02 and DBISAM 3.27 and for the life of me, I cannot get the engine to work. While it will create the Icon, if I go to delete the engine Icon from the form, I get hit with an AV. Once I hit the AV, delphi will not close. While I feel rather like a fool, Can someone who has it working perhaps enlighten me?

    Regards,

    Larry

Leave a Comment