testopen.pp 1.2 KB

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