Page 1 of 1

Mysql Datetime format Integer Overflow Bug?

Posted: 30.09.2020, 17:06
by billarchive
Using Delphi 7 , Maria DB 10.1.25 and Zeos 7.2.4

I am having to work with a table in database where there is a field of format of 'datetime (6) ' ie 6 fractional seconds parts as opposed to the default which is (0) none.
Queries on fields with this format always seem to end with 'Integer Overflow'

The exception occurs within : function TZAbstractMySQLResultSet.GetTimestamp(ColumnIndex: Integer): TDateTime; within unit ZDbcMySqlResultSet;

at the line: if (ConSettings^.ReadFormatSettings.DateTimeFormatLen - Len) <= 4 then...

Breaking at this point with the debugger : ConSettings^.ReadFormatSettings.DateTimeFormatLen evalutes as 19,
Len as 26 and the buffer as ''1962-11-23 22:33:00.000000' You can see the datetime 6 format here. It exceptions if this line is executed.

Is there a known bug / workaround or am I missing something?

Re: Mysql Datetime format Integer Overflow Bug?

Posted: 01.10.2020, 14:57
by marsupilami
Hello billarchive,

welcome to the Forums :)
billarchive wrote: 30.09.2020, 17:06 Using Delphi 7 , Maria DB 10.1.25 and Zeos 7.2.4
Could you please try the current development version of Zeos 7.2? See https://sourceforge.net/p/zeoslib/code-0/HEAD/tree/branches/7.2-patches/. Maybe the bug is already fixed there. Zeos 7.2.4 is more than 2 years old now.

Best regards,

Jan

Re: Mysql Datetime format Integer Overflow Bug?

Posted: 02.10.2020, 06:45
by EgonHugeist
Hi billarchive,
as Jan suggest, update from (SVN)-7.2-fixes branch first if you want stay in 7.2. An exception should be thrown, but a rounding of the fractions seems to be required.

Note 7.3 (SVN)\trunk and \testing-7.3 already do support those exact time/Timestamp values including the invalid '0000-00-00' date value mysql supports. On 7.3 a new records to handle such fields corectly. So download a snapshot if you are not using SVN. Have fun.