#1 2017-04-26 16:15:55

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Fix to timestamp bug regression

Hi @ab, this fix https://synopse.info/fossil/info/f69f5eb7d2ed6541 introduced a bug with error "Invalid point operation".

your fix:

...
  ftDate, ftTime, ftDateTime:
    if PDateTime(Data)^=0 then
      result := false else begin
      TS := DateTimeToTimeStamp(PDateTime(Data)^);
      if (TS.Time<0) or (TS.Date<=0) then
        result := false else // matches ValidateTimeStamp() expectations
        case Field.DataType of
        ftDate:     PDateTimeRec(Dest)^.Date := TS.Date;
        ftTime:     PDateTimeRec(Dest)^.Time := TS.Time;
        ftDateTime: PDateTimeRec(Dest)^.DateTime := TimeStampToMSecs(TS) //-->> YOUR FIX !!!
        end;
    end;
  ftString: begin
...

the solution:

...
  ftDate, ftTime, ftDateTime:
    if PDateTime(Data)^=0 then
      result := false else begin
      TS := DateTimeToTimeStamp(PDateTime(Data)^);
      if (TS.Time<0) or (TS.Date<=0) then
        result := false else // matches ValidateTimeStamp() expectations
        case Field.DataType of
        ftDate:     PDateTimeRec(Dest)^.Date := TS.Date;
        ftTime:     PDateTimeRec(Dest)^.Time := TS.Time;
        ftDateTime: PDateTimeRec(Dest)^.DateTime := PDateTime(Data)^; //-->> THE SOLUTION !!!
        end;
    end;
  ftString: begin
...

this correction working for me, but I can be wrong.

Best regards.


Esteban

Offline

#2 2017-04-26 18:58:49

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

Re: Fix to timestamp bug regression

Offline

#3 2017-04-26 19:39:31

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Fix to timestamp bug regression

works fine.

Thanks.


Esteban

Offline

#4 2017-04-30 22:38:10

Junior/RO
Member
Registered: 2011-05-13
Posts: 210

Re: Fix to timestamp bug regression

That don't works for me. The @ab solution works.

ftDateTime: PDateTimeRec(Dest)^.DateTime := TimeStampToMSecs(TS);

^this works

Offline

#5 2017-05-19 14:05:26

Chris75018
Member
From: France
Registered: 2012-09-14
Posts: 26
Website

Re: Fix to timestamp bug regression

That don't works for me too.
The @ab solution works.

--> ftDateTime: PDateTimeRec(Dest)^.DateTime := TimeStampToMSecs(TS);

If TS have not Time part (TS.Time = 0) then PDateTime(Data)^ doesn't have a valid date.

I used DataSetToJSON(MyInterbaseQuery) to store data in RawUTF8 buffer.
I reload data with TSynSQLTableDataSet.CreateFromJSON(nil, MyBuffer, MyTSQLFieldsType)

Offline

#6 2017-05-20 15:33:23

Junior/RO
Member
Registered: 2011-05-13
Posts: 210

Re: Fix to timestamp bug regression

@ab what you think?

Offline

#7 2017-05-20 15:52:56

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: Fix to timestamp bug regression

my solution solved my problem with new data but not with existing, I can confirm that the bug regression still exists.


Esteban

Offline

#8 2017-07-25 19:22:08

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

Re: Fix to timestamp bug regression

Please try https://synopse.info/fossil/info/d171280064

I've reverted to the previous version, which was reported to work - but for EMartin...

Offline

Board footer

Powered by FluxBB