#1 2014-09-20 16:52:25

GetCoffee
Member
Registered: 2014-09-20
Posts: 9

TSQLRecord and TSQLRestServerDB

Hi there,

I got a simple question and cannot find the answer in the samples.

I got an class that inherit TSQLRecord and TSQLRestServerDB. I do everything as in the 02 - Embedded SQLite3 ORM sample, anyway now i want load the data from the sqlite3 file (its created). An here is the problem i use the method RetrieveList wich retrieves me some records but all of them are empty (only the headers of TSQLRecord are saved or assigned somewhere).

Cannot get it to load data from the TSQLRestServerDB.

Any hints? I tried FillPrepare, FillRow, FillOne no success.

Best Regards,
LB.

Offline

#2 2014-09-20 17:57:55

cheemeng
Member
From: Malaysia
Registered: 2011-08-09
Posts: 61

Re: TSQLRecord and TSQLRestServerDB

Some code would be useful smile

Offline

#3 2014-09-20 18:11:21

GetCoffee
Member
Registered: 2014-09-20
Posts: 9

Re: TSQLRecord and TSQLRestServerDB

FModel := TSQLModel.Create([TEntryDb]);
  FDatabase := TSQLRestServerDB.Create(FModel, AFilename);
  TSQLRestServerDB(FDatabase).CreateMissingTables(0);
  FList := TSQLRestServerDB(FDatabase).RetrieveList(TEntryDb, nil, []);

Hm, nothing special same code like in sample 2. I did add the records like in the sample 02.

Offline

#4 2014-09-20 18:27:51

cheemeng
Member
From: Malaysia
Registered: 2011-08-09
Posts: 61

Re: TSQLRecord and TSQLRestServerDB

Why not access it this way?

var
  Entries: TEntryDB;

Entries := TEntryDB.CreateAndFillPrepare(FDatabase, yourQueryHere);
while Entries.FillOne do
begin
  Display(Entries.SomeProperty);
end;

Offline

#5 2014-09-20 18:50:41

GetCoffee
Member
Registered: 2014-09-20
Posts: 9

Re: TSQLRecord and TSQLRestServerDB

Hm, I just saw that FDatabase.Add doesnt add any fields to it... Anyway, should i do something more than just inherit from TSQLRecord and make published properties so they should be visible as fields?

ps. Thats quite strange, because the sample works as expected - but not mine..
ps2. I did find out, that my model TSQLTest = class(TSQLRecord) doesnt have any fields, just an ID. Solved: I did have the fields in the public section of the class not published... Omg. wink

Last edited by GetCoffee (2014-09-20 20:02:26)

Offline

Board footer

Powered by FluxBB