You are not logged in.
Pages: 1
We try to implement a rtee on a virtual table using TSQLRecordRTree and TSQLRestServerStaticInMemory.
The descendant of TSQLRecordRTree is defined as:
  
  TSQLRecordMapBox = class(TSQLRecordRTree)
  protected
    fMinX, fMaxX, fMinY, fMaxY: double;
  public
    AData: tObject;
  published
    property MinX: double read fMinX write fMinX;
    property MaxX: double read fMaxX write fMaxX;
    property MinY: double read fMinY write fMinY;
    property MaxY: double read fMaxY write fMaxY;
  end;
  
The virtual Table is created and filled like this:
procedure TForm2.FormCreate(Sender: TObject);
  procedure Add(x1, y1, x2, y2: double);
  var
    Rec: TSQLRecordMapBox;
  begin
    Rec := TSQLRecordMapBox.Create;
    try
      Rec.MinX := x1;
      Rec.MinY := y1;
      Rec.MaxX := x2;
      Rec.MaxY := y2;
      if m_Database.Add(Rec,true)=0 then begin
        ShowMessage('Error adding the data');
      end;
    finally
      Rec.Free;
    end;
  end;
begin
  m_Database := TSQLRestServerStaticInMemory.Create(TSQLRecordMapBox,nil,
    ChangeFileExt(paramstr(0),'.db'));
  m_Model := TSQLModel.Create([TSQLRecordMapBox]);
  Add(0,0,1,1);
  Add(1,1,2,2);
end;
The first problem is that TSQLRestServerStaticInMemory is a descendant of TSQLRestServer but the procedure RTreeMatches is a method of TSQLRestClient.
How can I query the data in TSQLRestServerStaticInMemory using the RTree.
In my second trial I used the NamedPipeClientServerExample to test the RTReeMach-Method.
On serverside I replaced TSQLSampleRecord with my TSQLRecordMapBox.
On clientside I changed the eventhandler of the "add the message"-button to:
procedure TForm1.AddButtonClick(Sender: TObject);
  procedure Add(x1, y1, x2, y2: double);
  var
    Rec: TSQLRecordMapBox;
  begin
    Rec := TSQLRecordMapBox.Create;
    try
      Rec.MinX := x1;
      Rec.MinY := y1;
      Rec.MaxX := x2;
      Rec.MaxY := y2;
      if Database.Add(Rec,true)=0 then begin
        ShowMessage('Error adding the data');
      end;
    finally
      Rec.Free;
    end;
  end;
begin
  Add(0,0,1,1);
  Add(1,1,2,2);
end;
Then I changed the eventhandler of the "Find a previous message"-Button to:
procedure TForm1.FindButtonClick(Sender: TObject);
var Rec: TSQLRecordMapBox;
  DataID: TIntegerDynArray;
begin
  Rec := TSQLSampleRecord.Create;
  try
    (database as TSQLRestClientURINamedPipe).RTreeMatch(TSQLSampleRecord,'BlobField',TSQLRecordMapBox, Rec.BlobField,DataID);
  finally
    Rec.Free;
  end;
end;
But the TSQLRecordRTree has not a member Blobfield which can be used.
Obviously is that one the differences between the TSQLRecordMapBox and the TSQLRecordMapData. Unfortunately I could not find the declaration of TSQLRecordMapData.
Is there any possibility to get an example for implementing a virtual table with RTrees?
Or is there any possibility to get a (paid) support?
Hello,
where can I find a short code example which shows how to create a virtual table with TSQLRecordRtree, add some Data and search data?
Thanks.
Pages: 1