#1 2016-03-17 19:42:51

hnb
Member
Registered: 2015-06-15
Posts: 290

[patch] Compute Fields After Fill

Hi smile

I have new classes for computing fields: TSQLRecordFillComputed and TSQLComputedRecord. Two possibilities:

1. OnCompute event in TSQLComputedRecord can be used only after "CreateAndFillPrepare" constructor.
2. Custom TSQLRecordFillComputed by overriding ComputeFieldsAfterFill + custom TSQLRecord by overriding RecordFillClass

patch attached:
https://drive.google.com/file/d/0B4PZhd … sp=sharing

best regards,
Maciej Izak


best regards,
Maciej Izak

Offline

#2 2016-03-18 17:49:48

hnb
Member
Registered: 2015-06-15
Posts: 290

Re: [patch] Compute Fields After Fill

Any chance to merge? (or to implement some similar solution?)


best regards,
Maciej Izak

Offline

#3 2016-03-30 09:50:53

hnb
Member
Registered: 2015-06-15
Posts: 290

Re: [patch] Compute Fields After Fill

ping? Maybe TSQLComputedRecord is not perfect but TSQLRecordFillComputed can be merged (even without OnCompute event)...

I need only ComputeFieldsAfterFill from TSQLRecordFillComputed in trunk...


best regards,
Maciej Izak

Offline

#4 2016-03-30 16:59:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: [patch] Compute Fields After Fill

Your patch was breaking existing code, and should not be added as such.

I still do not understand why you cannot just call your own process before / after calling TSQLRecord.FillOne?

Offline

#5 2016-03-30 17:18:03

hnb
Member
Registered: 2015-06-15
Posts: 290

Re: [patch] Compute Fields After Fill

I'd like to have comparable feature to existing ComputeFieldsBeforeWrite but for "After Read". Why we have ComputeFieldsBeforeWrite? I see lack in framework for something like "ComputeFieldsAfterRead".


best regards,
Maciej Izak

Offline

#6 2016-03-30 18:14:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: [patch] Compute Fields After Fill

Because you can just define a getter method for computed fields.
See http://synopse.info/files/html/Synopse% … #TITLE_103

Offline

#7 2016-03-30 19:12:35

hnb
Member
Registered: 2015-06-15
Posts: 290

Re: [patch] Compute Fields After Fill

Yes I know. I read it several times and IMO mORMot is incomplete in this matter. In my case it is not "just" defining of "few" getters smile Lack of something like "After Read/Fill" is big problem. I don't get why we have ComputeFieldsBeforeWrite and we don't have Compute from other perspective like "ComputeFieldsAfterRead".

It is like saying that I need only "finalize" section without "initialize" because I can do the same things just after main begin keyword >.<. I need equivalent of

procedure Loaded; virtual;

from TComponent which is called after loading all properties from dfm stream. Using "getters" is not the same like collective event after "fill".


best regards,
Maciej Izak

Offline

#8 2016-03-31 09:03:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: [patch] Compute Fields After Fill

ComputeFieldsBeforeWrite is there to fill the TModTime and TCreateTime fields before insertion, on the client side.
It is not what you expect, for sure!

Why not write a SOA service to return the data as expected, leaving the ORM alone from anything but values persistence?

Offline

#9 2016-03-31 19:43:32

hnb
Member
Registered: 2015-06-15
Posts: 290

Re: [patch] Compute Fields After Fill

Thanks for advice. After small redesign, my code seems more solid. Hmmm.


best regards,
Maciej Izak

Offline

Board footer

Powered by FluxBB