Hello, first to request excuses because I do not dominate the English and I have translated the text with the translator of Google.
I have had he himself problem. I have been studying the changes and have obtained that it works. For it it is necessary to modify the unit “FIBDataSet.pas” of “FIBL”. As or it has been said before the problem takes place because in version 2.0.4 of the FPC the format of the fields is modified that store to dates or hours. In FIBDataSet.pas one always works with TDateTime whereas in the FPC depends on if the field is a TDate, TTime or TDateTime.
The modification of the FPC that affects to us finds in “lazarus \ fpc \ 2.0.4 \ source \ fcl \ db \ dataset.inc” and affects the functions SetFieldData and GetFieldData. In them, in case the field is type ftDate, ftTime or ftDateTime makes a conversion to TDateTimeRec that causes the error in “FIBL” library (See lines 519 and 590 of dataset.inc). In order to solve it that conversion must undo in “FIBDataSet.pas” (the new thing is enclosed between //***************************************):
LINE 1989:
function TFIBCustomDataSet.GetFieldData(Field: TField; Buffer: Pointer): Boolean;
var
Buff, Data: PChar;
CurrRecord: PRecordData;
begin
result := False;
Buff := GetActiveBuf;
if (Buff = nil) or (not IsVisible(Buff)) then exit;
(* The intention here is to stuff the buffer with the data for the *)
(* referenced field for the current record. *)
CurrRecord := PRecordData(Buff);
if (Field.FieldNo > 0) and
(Field.FieldNo <= CurrRecord^.rdFieldCount) then begin
if (not IsVisible(Buff)) then begin
end else begin
result := not CurrRecord^.rdFields[Field.FieldNo].fdIsNull;
if result and (Buffer <> nil) then
with CurrRecord^.rdFields[Field.FieldNo] do begin
Data := Buff + CurrRecord^.rdFields[Field.FieldNo].fdDataOfs;
if (fdDataType = SQL_VARYING) or (fdDataType = SQL_TEXT) then begin
Move(Data^, Buffer^, fdDataLength);
PChar(Buffer)[fdDataLength] := #0;
end
//***************************************
else if (Field.DataType in [ftDate, ftTime, ftDateTime]) then
TDateTimeRec(buffer^) := DateTimeToDateTimeRec(Field.DataType, TDateTime(pointer(Data)^))
//***************************************
else
Move(Data^, Buffer^, Field.DataSize);
end;
end
end else if (Field.FieldNo < 0) then begin
Inc(Buff, FRecordSize + Field.Offset);
result := Boolean(Buff[0]);
if result and (Buffer <> nil) then
Move(Buff[1], Buffer^, Field.DataSize);
end;
end;
LINE 2587:
procedure TFIBCustomDataSet.SetFieldData(Field: TField; Buffer: Pointer);
var
Buff, TmpBuff: PChar;
begin
(* Cannot update a record without a FQUpdate query existing. *)
Buff := GetActiveBuf;
if Field.FieldNo < 0 then begin
TmpBuff := Buff + FRecordSize + Field.Offset;
Boolean(TmpBuff[0]) := LongBool(Buffer);
if Boolean(TmpBuff[0]) then
Move(Buffer^, TmpBuff[1], Field.DataSize);
WriteRecordCache(PRecordData(Buff)^.rdRecordNumber, Buff);
end else begin
CheckEditState;
with PRecordData(Buff)^ do begin
(* If inserting, make sure certain settings are established. *)
CheckInsertMode(Buff);
if (Field.FieldNo > 0) and (Field.FieldNo <= rdFieldCount) then begin
Field.Validate(Buffer);
if (Buffer = nil) or
(Field is TFIBStringField) and (PChar(Buffer)[0] = #0) then
rdFields[Field.FieldNo].fdIsNull := True
else begin
//***************************************
if (Field.DataType in [ftDate, ftTime, ftDateTime]) then
TDateTime(buffer^) := DateTimeRecToDateTime(Field.DataType, TDateTimeRec(buffer^));
//***************************************
Move(Buffer^, Buff[rdFields[Field.FieldNo].fdDataOfs],
rdFields[Field.FieldNo].fdDataSize);
if (rdFields[Field.FieldNo].fdDataType = SQL_TEXT) or
(rdFields[Field.FieldNo].fdDataType = SQL_VARYING) then
rdFields[Field.FieldNo].fdDataLength := StrLen(PChar(Buffer));
rdFields[Field.FieldNo].fdIsNull := False;
if rdUpdateStatus = usUnmodified then begin
if State = dsInsert then
rdUpdateStatus := usInserted
else
rdUpdateStatus := usModified;
end;
WriteRecordCache(rdRecordNumber, Buff);
SetModified(True);
end;
end;
end;
end;
if not (State in [dsCalcFields, dsFilter, dsNewValue]) then
DataEvent(deFieldChange, Longint(Field));
end;
I hope that this solves your problem. Greetings.