mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 23:50:37 +02:00
* Fixes datetime values <0
* Fixed time-intervals longer then 24 hours * Use 'DATETIME' fields in tests, because mysql's 'TIMESTAMPS' are limited git-svn-id: trunk@17416 -
This commit is contained in:
parent
7f1a6b8e3e
commit
122494f5ea
@ -175,7 +175,11 @@ Type
|
||||
|
||||
implementation
|
||||
|
||||
uses dbconst,ctypes,strutils;
|
||||
uses
|
||||
dbconst,
|
||||
ctypes,
|
||||
strutils,
|
||||
dateutils;
|
||||
|
||||
const
|
||||
Mysql_Option_Names : array[mysql_option] of string = ('MYSQL_OPT_CONNECT_TIMEOUT','MYSQL_OPT_COMPRESS',
|
||||
@ -777,7 +781,7 @@ begin
|
||||
Result := 0
|
||||
else
|
||||
Result := EncodeDate(EY, EM, ED);
|
||||
Result := Result + EncodeTime(EH, EN, ES, 0);
|
||||
Result := ComposeDateTime(Result,EncodeTime(EH, EN, ES, 0);
|
||||
end;
|
||||
|
||||
function InternalStrToTime(S: string): TDateTime;
|
||||
@ -789,7 +793,7 @@ begin
|
||||
EH := StrToInt(Copy(S, 1, 2));
|
||||
EM := StrToInt(Copy(S, 4, 2));
|
||||
ES := StrToInt(Copy(S, 7, 2));
|
||||
Result := EncodeTime(EH, EM, ES, 0);
|
||||
Result := EncodeTimeInterval(EH, EM, ES, 0);
|
||||
end;
|
||||
|
||||
function InternalStrToTimeStamp(S: string): TDateTime;
|
||||
|
@ -114,6 +114,13 @@ begin
|
||||
for t := 0 to testValuesCount-1 do
|
||||
testStringValues[t] := TrimRight(testStringValues[t]);
|
||||
end;
|
||||
if SQLDbType in [mysql41,mysql50,mysql51] then
|
||||
begin
|
||||
// Use 'DATETIME' for datetime-fields in stead of timestamp, because
|
||||
// mysql's timestamps are only valid in the range 1970-2038.
|
||||
// Downside is that fields defined as 'TIMESTAMP' aren't tested
|
||||
FieldtypeDefinitions[ftDateTime] := 'DATETIME';
|
||||
end;
|
||||
if SQLDbType in [odbc,mysql40,mysql41,mysql50,mysql51] then
|
||||
begin
|
||||
// Some DB's do not support milliseconds in time-fields.
|
||||
|
Loading…
Reference in New Issue
Block a user