testopen.pp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {
  2. This file is part of the Free Component Library (FCL)
  3. Copyright (c) 1999-2000 by the Free Pascal development team
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. {$mode objfpc}
  11. {$h+}
  12. program testopen;
  13. uses db,memds,classes,sysutils;
  14. Procedure DoTest;
  15. var
  16. I,ACount : integer;
  17. D : TDateTime;
  18. begin
  19. with TMemDataset.Create(Nil) do
  20. Try
  21. FileName:=ParamStr(1);
  22. Open;
  23. First;
  24. ACount:=0;
  25. While Not EOF do
  26. begin
  27. Inc(ACount);
  28. Writeln('Record ',ACount,' : ');
  29. Writeln('------------------------');
  30. For I:=0 to FieldCount-1 do
  31. Writeln(Fields[I].FieldName,' : ',Fields[I].AsString);
  32. Writeln;
  33. Next;
  34. end;
  35. Writeln('Total data size : ',DataSize);
  36. Close;
  37. finally
  38. Free;
  39. end;
  40. end;
  41. begin
  42. If ParamCount<>1 then
  43. begin
  44. Writeln('Usage : testopen <filename>');
  45. Halt(1);
  46. end;
  47. DoTest;
  48. end.