#1 Re: mORMot 1 » Problem with TSQLRecordRTree » 2013-02-08 10:31:27

I downloaded the latest version (2013-02-07 20:51:25), and also get an exception.
Tables created with class "TSQLRecord" work correctly.
I use Delphi7 Pro.

#2 mORMot 1 » Problem with TSQLRecordRTree » 2013-02-07 11:12:17

piotrkbydg
Replies: 3

Hi,

I tried to create a RTree Index, but I get an exception when creating a tables : "No registered module for TSQLRecordProperties".

My test code :

...
type
  TDoublePoint=packed record
    x,y:double;
  end;

  TSQLPoint=class(TSQLRecord)
  private
    Fname:RawUTF8;
    Fxy:TDoublePoint;
  published
    property xy:TDoublePoint read Fxy write Fxy;
    property name:RawUTF8 read Fname write Fname;
  end;

  TSQLPointBox=class(TSQLRecordRTree)
  protected
    Fminx:Double;
    Fmaxx:Double;
    Fminy:Double;
    Fmaxy:Double;
  public
    class procedure BlobToCoord(const InBlob; var OutCoord: TSQLRecordTreeCoords);override;
  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;

  TMainForm = class(TForm)
    btnCreate: TButton;
    procedure btnCreateClick(Sender: TObject);
  private
    procedure CreateDB;
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

class procedure TSQLPointBox.BlobToCoord(const InBlob;
  var OutCoord: TSQLRecordTreeCoords);
begin
  OutCoord[0].min:=TDoublePoint(InBlob).x;
  OutCoord[0].max:=TDoublePoint(InBlob).x;
  OutCoord[1].min:=TDoublePoint(InBlob).y;
  OutCoord[1].max:=TDoublePoint(InBlob).y;
end;

procedure TMainForm.CreateDB;
var
  model:TSQLModel;
  server:TSQLRestServerDB;
begin
  model:=TSQLModel.Create([TSQLPoint,TSQLPointBox]);
  try
    server:=TSQLRestServerDB.Create(model,'localdb.db3',False,'');
    if(Assigned(server)) then
    begin
      try
        server.CreateMissingTables(0);  ---> "No registered module for TSQLRecordProperties".     
      finally
        server.Free;
      end;
    end;
  finally
    model.Free;
  end;
end;

procedure TMainForm.btnCreateClick(Sender: TObject);
begin
  CreateDB;
end;


Is there anything else I need to do before "server.CreateMissingTables(0);" ?

Thank you

Board footer

Powered by FluxBB