[fpc-devel] TSdfDataset does not work with records larger then 255 chars

Martin Schreiber fpmse at bluewin.ch
Mon Sep 8 15:51:32 CEST 2008


On Monday 08 September 2008 14.42:04 Felipe Monteiro de Carvalho wrote:
> On 9/8/08, Marco van de Voort <marcov at stack.nl> wrote:
> > That shoulds like a shortstring limit. Is everything in {$H+} or {$mode
> >  delphi} ?
>
> This was my first idea, but I couldn't find anywhere a H+ missing ...
>
> Also, as to my previous statement that it now started without without
> reason, it seams only to have moved to a higher limit. I am getting
> cut with 310 chars.

Did you open an existing datafile?
"
procedure TFixedFormatDataSet.InternalInitFieldDefs;
var
  i, len, Maxlen :Integer;
  LstFields      :TStrings;
begin
  if not Assigned(FData) then
    exit;
  FRecordSize := 0;
  Maxlen := 0;
  FieldDefs.Clear;
  for i := FData.Count - 1 downto 0 do  // Find out the longest record <<<--
  begin
    len := Length(FData[i]);
    if len > Maxlen then
      Maxlen := len;                   <<<--
    FData.Objects[i] := TObject(Pointer(i+1));   // Fabricate Bookmarks
  end;
  if (Maxlen = 0) then
    Maxlen := MAXSTRLEN;
  LstFields := TStringList.Create;
  try
    LoadFieldScheme(LstFields, Maxlen);
    for i := 0 to LstFields.Count -1 do  // Add fields
    begin
      len := StrToIntDef(LstFields.Values[LstFields.Names[i]], Maxlen); <<<--
"
Martin



More information about the fpc-devel mailing list