Test on Firebird 3.0.7 and different version of IBDAC (included last one).
When using AsDatetime a value can cause a SQL Error "Value exceeds the range for valid timestamps"
This code :
Code: Select all
procedure TForm17.Button1Click(Sender: TObject);
var
i:integer;
MaDateIntervention,dummy:Tdatetime;
myYear,myMonth, myDay,MyHour,MyMinute,MySecond,MyMilliseconde:word;
ValeurPrecise:double;
begin
MaDateIntervention := now;
DecodeDate(MaDateIntervention, myYear, myMonth, myDay);
MaDateIntervention := EncodeDateTime(myYear, myMonth, myDay, 9, 00, 00, 00);
for i:=0 to 20 do
begin
MaDateIntervention := MaDateIntervention + 1/24;
IBCQuery1.ParamByName('MyDate').DataType:= ftDateTime;
IBCQuery1.ParamByName('MyDate').asdatetime:= MaDateIntervention;
IBCQuery1.ExecSQL;
end;
end;
Code: Select all
object IBCQuery1: TIBCQuery
Connection = IBCConnection1
SQL.Strings = (
'insert into DB_KEY_TABLE'
'(STAMP_ADD)'
'values'
'(:MyDAte)')
Left = 272
Top = 72
ParamData = <
item
DataType = ftUnknown
Name = 'MyDAte'
Value = nil
end>
end
Of course the solution is to replace ;
Code: Select all
MaDateIntervention := MaDateIntervention + 1/24;
Code: Select all
MaDateIntervention:=incHour(MaDateIntervention,1);
So there is no check/filter in IBDAC level. Does it exists a way, with an explicit DataType and AsDateTime, to force check or convert or round a TimeStamp value at IBDAC level ?