#1 2017-04-07 08:42:04

mbadstones
Member
Registered: 2017-04-01
Posts: 5

EConvertError with message "0.42821" is a not valid timestamp

I have same problem with:
* ToDataSet, ToClientDataSet when read data from Firebird 2.1
Sorry form bad english !
See image !
https://drive.google.com/open?id=0Bzdd_ … 0p5azZ2aDg

Congratulation for the great mormot project !

Offline

#2 2017-04-07 11:08:17

Sebo
Member
Registered: 2016-01-23
Posts: 2

Re: EConvertError with message "0.42821" is a not valid timestamp

I have the same issue with MySQL + ZEOS, assigning TSynDBDataSet created form TSQLDBStatement with DATETIME fields to TDataSource connected with grid causes "Is not valid timestamp" exception.

Offline

#3 2017-04-24 13:56:23

joananjr
Member
From: Brasil
Registered: 2017-04-24
Posts: 8

Re: EConvertError with message "0.42821" is a not valid timestamp

i got the same problem

Offline

#4 2017-04-24 18:09:55

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

Re: EConvertError with message "0.42821" is a not valid timestamp

With latest 1.18.3629 revision?

Offline

#5 2017-04-27 21:41:18

joananjr
Member
From: Brasil
Registered: 2017-04-24
Posts: 8

Re: EConvertError with message "0.42821" is a not valid timestamp

i got today 27 apr 2017 the lastest version of mormot and the error raised agan.

Offline

#6 2017-04-27 21:44:19

joananjr
Member
From: Brasil
Registered: 2017-04-24
Posts: 8

Re: EConvertError with message "0.42821" is a not valid timestamp

I tested with firebird and mysql sql. Both raise the same error. I think that's this error in SynDbZeos...

Offline

#7 2017-04-28 19:57:07

joananjr
Member
From: Brasil
Registered: 2017-04-24
Posts: 8

Re: EConvertError with message "0.42821" is a not valid timestamp

Well, today I tested with the sqlite and I use to connect

    Props := TSQLDBSQLite3ConnectionProperties.Create('testedbsqlite.db3', '', '', '' );

then a single sql in memo end run this code

  datasource.dataset := ToDataSet(Self, Props.Execute(Memo1.Text, []));

If no date, datetime or time fields at table run ok. But if existe any date, datetime and time field the error raise at the same form that raise in firebird and mysql using zeos.

I think new that this error is in ToDateSet procedure.

But I knew a person in facebook that use mormot than I ask if he help-me with this issue. I send to him my source exemplo and,
For my surprise, the code runs nice.

I create a new virtual machine with Windows, i installed delphi and mormot and zeos. But the error raise agan im my new machine.

That´s crucial tu me for use mormot becouse i will don´t use ORM i only need to user direct acess for firebrd, sqlite or mysql

Offline

#8 2017-04-29 04:20:06

joananjr
Member
From: Brasil
Registered: 2017-04-24
Posts: 8

Re: EConvertError with message "0.42821" is a not valid timestamp

I maked more tests. I return to use mysql and i verify that even using  SQLDBRows.Step  the contente of columns of type DateTime retrive a blank value. At this tima i did not use ToDataSet procedure. I.E. The problem problably do not reside in ToDataSet procedure.

Offline

#9 2017-04-29 05:18:04

1324812958@qq.com
Member
From: cn
Registered: 2017-04-09
Posts: 2

Re: EConvertError with message "0.42821" is a not valid timestamp

SynVirtualDataSet.pas


+Add

  function DateTimeToNative(DataType: TFieldType; Data: TDateTime): TDateTimeRec;
  var
    TimeStamp: TTimeStamp;
  begin
    TimeStamp := DateTimeToTimeStamp(Data);
    case DataType of
      ftDate: Result.Date := TimeStamp.Date;
      ftTime: Result.Time := TimeStamp.Time;
    else
      Result.DateTime := TimeStampToMSecs(TimeStamp);
    end;
  end;

...
  ftDate, ftTime:
    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;
        end;
    end;
  ftDateTime:   
     // Change to this.
     TDateTimeRec(Dest^) := DateTimeToNative(Field.DataType, TDateTime(Data^));
    //PDateTimeRec(Dest)^.DateTime := PDateTime(Data)^;   

Offline

#10 2017-04-30 03:20:00

joananjr
Member
From: Brasil
Registered: 2017-04-24
Posts: 8

Re: EConvertError with message "0.42821" is a not valid timestamp

Well, i maked tests with this modifications.  Works almost well.

The error no more raise, the contente of TDateField are ok. But the content of TTimeFields apears with blank Date together. If we use editmask property at TTime field raise the error invalid timefield becouse the delphi dont expect these date together.

But i'm happy. Plase qq if you can correct this on yor code. Thakss a lot.

Offline

#11 2017-04-30 05:48:12

1324812958@qq.com
Member
From: cn
Registered: 2017-04-09
Posts: 2

Re: EConvertError with message "0.42821" is a not valid timestamp

I will try to handle it, but I believe that ab is already being processed   smile

Offline

#12 2017-05-01 15:18:35

mbadstones
Member
Registered: 2017-04-01
Posts: 5

Re: EConvertError with message "0.42821" is a not valid timestamp

ab
i've the 1.18.2975 version !

Offline

#13 2017-07-25 19:20:01

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

Re: EConvertError with message "0.42821" is a not valid timestamp

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

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

Offline

#14 2017-07-25 19:22:24

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

Re: EConvertError with message "0.42821" is a not valid timestamp

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

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

Offline

#15 2017-07-28 16:47:51

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

Re: EConvertError with message "0.42821" is a not valid timestamp

Oh thank you

Offline

Board footer

Powered by FluxBB