summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/fcl-db/src/sdf/testfix.pp
blob: ac47cf57516cb8984543ff69065960da07bc1021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{$mode objfpc}
{$h+}
program testfix;

uses DB,sdfdata,sysutils;

Procedure Dotest;

Var
  I,Count : Integer;

begin
  With TFixedFormatDataSet.Create(Nil) do
    try
      FileName := 'fpc.ssx';
      Schema.Add('First Name=20');
      Schema.Add('Last Name=20');
      Schema.Add('Email=30');
      Open;
      Count:=0;
      Try
        While Not EOF do
          begin
          Inc(Count);
          Writeln('Record : ',Count);
          For I:=0 to FieldCount-1 do
            Writeln(Fields[i].FieldName,' : ',Fields[i].AsString);
          Writeln('-------------------------------')  ;
          Next;
          end;
      Finally
        Close;
      end;
    finally
      free;
    end;
end;

begin
  DoTest;
end.