Re: [MSEide-MSEgui-talk] tsequencelink incorrect value assignment

2013-03-21 Thread Martin Schreiber
On Wednesday 20 March 2013 20:59:35 Julio Jiménez wrote:
 Sequence value is generated before tmsesqlquery.beforepost so if you cancel
 post a value in the sequence is lost (unassigned)

AFAIK there can be unassigned values anyway if the transaction will be 
canceled later?

 I think the correct is to generate it after post and if the value is null
 (dataset field value)

The sequence value is fetched in tdatlink.updatedata (dataevent 
deUpdateRecord):

procedure tsequencedatalink.updatedata;
begin
 inherited;
 if (field  nil) and field.isnull and (dataset  nil) and 
  ((dataset.modified) or 
   (fdscontroller  nil) and fdscontroller.posting) then begin
  if field.datatype in [ftlargeint,ftfloat,ftcurrency,ftbcd] then begin
   field.aslargeint:= fownerlink.aslargeint;
  end
  else begin
   field.asinteger:= fownerlink.asinteger;
  end;
 end;
end;

The purpose is that the field values are complete in onbeforepost.
If you don't want this behavior don't set tsequencelink.datafield and assign 
the field value in onbeforepost

thefield.asinteger:= thesequencelink.asinteger.

Another possibility is to genereate the key server-side by a trigger in 
applyupdate and to set providerflags1 pf1_refreshinsert/pf1_refreshupdate of 
the affected fields in order to automatically refresh the generated value.

Martin

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] tsequencelink incorrect value assignment

2013-03-21 Thread Julio Jiménez
I have no problem in generating sequence value and avoid this 'issue' (in
fact I used sequences in mseide before the component was created). I was
only pointing out what other database components like ZeosLib and IBX  do.

If the purpose is that the fileds values are complete in onbeforepost, then
it's ok.

Thanks.


2013/3/21 Martin Schreiber mse00...@gmail.com

 On Wednesday 20 March 2013 20:59:35 Julio Jiménez wrote:
  Sequence value is generated before tmsesqlquery.beforepost so if you
 cancel
  post a value in the sequence is lost (unassigned)
 
 AFAIK there can be unassigned values anyway if the transaction will be
 canceled later?

  I think the correct is to generate it after post and if the value is null
  (dataset field value)

 The sequence value is fetched in tdatlink.updatedata (dataevent
 deUpdateRecord):
 
 procedure tsequencedatalink.updatedata;
 begin
  inherited;
  if (field  nil) and field.isnull and (dataset  nil) and
   ((dataset.modified) or
(fdscontroller  nil) and fdscontroller.posting) then begin
   if field.datatype in [ftlargeint,ftfloat,ftcurrency,ftbcd] then begin
field.aslargeint:= fownerlink.aslargeint;
   end
   else begin
field.asinteger:= fownerlink.asinteger;
   end;
  end;
 end;
 
 The purpose is that the field values are complete in onbeforepost.
 If you don't want this behavior don't set tsequencelink.datafield and
 assign
 the field value in onbeforepost
 
 thefield.asinteger:= thesequencelink.asinteger.
 
 Another possibility is to genereate the key server-side by a trigger in
 applyupdate and to set providerflags1 pf1_refreshinsert/pf1_refreshupdate
 of
 the affected fields in order to automatically refresh the generated value.

 Martin


-- 
Julio Jiménez Borreguero
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


[MSEide-MSEgui-talk] tsequencelink incorrect value assignment

2013-03-20 Thread Julio Jiménez
Sequence value is generated before tmsesqlquery.beforepost so if you cancel
post a value in the sequence is lost (unassigned)

I think the correct is to generate it after post and if the value is null
(dataset field value)

-- 
Julio Jiménez Borreguero
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk