fibl ve lazarus tarih sorunu

Kylix, Lazarus, Freepascal ile ilgili konuları buraya yazabilirsiniz.
Cevapla
Kullanıcı avatarı
selimr
Üye
Mesajlar: 556
Kayıt: 16 Eki 2003 02:07

fibl ve lazarus tarih sorunu

Mesaj gönderen selimr »

lazarus 0.9.16 dan sornaki sürümlerde , fibl componenti tarih alanlarını gridde gösterirken 00.00.0000 şeklinde gösteriyordu..

bu sorun şu şekilde düzeliyor..


1) FIBDataSet.pas dosyası içinde 1989 nolu satırdan başlayan fonksiyon şu şekilde olmalı

Kod: Tümünü seç

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;
2) 1) FIBDataSet.pas dosyası içinde 2587 nolu satırdan başlayan prosedür şu şekilde olmalı

Kod: Tümünü seç

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;
Cevapla