mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-20 04:07:41 +01:00
45 lines
761 B
ObjectPascal
45 lines
761 B
ObjectPascal
program dumpdb;
|
|
|
|
{$i+}
|
|
|
|
uses db,dbf,sysutils;
|
|
|
|
Procedure DumpTable (Const TN,FN : String);
|
|
|
|
Var
|
|
I,Count : longint;
|
|
F : Text;
|
|
Buf : Array[1..1024*4] of byte;
|
|
|
|
begin
|
|
Assign(F,FN);
|
|
Rewrite(F);
|
|
SetTextBuf(F,Buf);
|
|
With TDBF.Create(Nil) do
|
|
begin
|
|
TableName:=TN;
|
|
Open;
|
|
While not EOF do
|
|
begin
|
|
Inc(Count);
|
|
For I:=0 to FieldCount-1 do
|
|
With Fields[i] do
|
|
Writeln(F,FieldName:20,' : ',AsString);
|
|
Writeln(F,StringOfChar('=',72));
|
|
Next;
|
|
end;
|
|
end;
|
|
Writeln(F,'Dumped total of ',Count,' records.');
|
|
Close(F);
|
|
end;
|
|
|
|
Var i : longint;
|
|
|
|
begin
|
|
If ParamCount<2 then
|
|
begin
|
|
Writeln('Usage: dumpdb tablename filename');
|
|
Halt(1);
|
|
end;
|
|
DumpTable(Paramstr(1),Paramstr(2));
|
|
end. |