#1 Re: mORMot 1 » correctly use Read\Write\Delete to local SQLite » 2016-03-31 09:00:39

ty for all, i think now all ok.
Ya1ptQO.jpg
its free for use program, not for sale, but what you logo use in about screen or only name of library?

#2 Re: mORMot 1 » correctly use Read\Write\Delete to local SQLite » 2016-03-28 19:48:50

//my trys to create TSQLRestStorageInMemory
If Not Assigned(Model) Then
      Model := CreateSampleModel;
Database := TSQLRestClientDB.Create(Model, CreateSampleModel, filename, TSQLRestServerDB);
Database.Server.CreateMissingTables;
StDatabase :=  TSQLRestStorageInMemory.Create(TSQLPoint, Database.Server, filename);
StDatabase := TSQLRestStorageInMemory(Database.Server.StaticDataAdd(StDatabase));

Or i don`t need this - if all ok now all work - i use only Database.MultiFieldValues
And all read cycles use 4781 Mks

#3 Re: mORMot 1 » correctly use Read\Write\Delete to local SQLite » 2016-03-28 17:23:44

Ty for answer, very good documentation - i find what i need.
But, can i think best and easy way - TSQLRestStorageInMemory.
How use this is it? i have only 2 tables.
ty again.

#4 mORMot 1 » correctly use Read\Write\Delete to local SQLite » 2016-03-26 20:53:40

ivanius
Replies: 7

My first experience work with SQLite and DB, i use Delphi 2010 for create simple GPS where have 2 tables (TSQLLink = Class(TSQLRecord), TSQLPoint = Class(TSQLRecord)).
I read docs and forum, but cant find methods to do this:

Function DelPoint(ID: Int64): boolean;
Begin
  Result := false;
  If Assigned(MainForm.Database) Then
    Result := MainForm.Database.Delete(TSQLPoint, ID);
End;

Function AddLink(start_point_id: Integer = 0; end_point_id: Integer = 0; one_way: Integer = 0; temp_link: Integer = 0): Boolean;
Var
  Rec: TSQLLink;
Begin
  Result := False;
  If Assigned(MainForm.Database) Then
  Begin
    Rec := TSQLLink.Create;
    Try
      Rec.start_point_id := start_point_id;
      Rec.end_point_id := end_point_id;
      Rec.one_way := one_way;
      Rec.temp_link := temp_link;
      If MainForm.Database.Add(Rec, {true} false) = 0 Then //ofc here i have error of DB is Busy
        Result := False
      Else
      Begin
        MainForm.AddLinkList(MainForm.SGLink, Rec);
      End;
    Finally
      FreeAndNil(Rec);
    End;
  End;
End;
//....
   rcPoint := TSQLPoint.CreateAndFillPrepare(Database, 'X >= ? AND X <= ? AND Y >= ? AND Y <= ?', [OnMap.X - 150, OnMap.X + 150, OnMap.Y - 150, OnMap.Y + 150]);
   If rcPoint.FillOne Then
   Begin
     AddLink(Bottom, rcPoint.ID);
  end;
  FreeAndNil(rcPoint);

After thinking - i need store myPoints and myLinks in memory - do changes - update DB.
Generics\Dynarrays\TSQLTableJSON or?

i think i find - need FillClose; or use TSQLTableJSON.
Plz sry for my bad english.

Board footer

Powered by FluxBB