program	CSVReaderTest;

{$APPTYPE CONSOLE}

uses
  CSVReader in 'CSVReader.pas';

type
  TProgressInfo = class(TObject)
  public
    procedure OnProgress(Count:integer);
  end;

procedure TProgressInfo.OnProgress(Count:integer);
begin
  writeln(Count,'% done...');
end;

var
  DataSet : TCSVDataSet;
  PInfo   : TProgressInfo;
  i, j    : integer;

begin
  PInfo:=TProgressInfo.Create;
  DataSet:=TCSVDataSet.Create;
  DataSet.OnProgress:=PInfo.OnProgress;
  if not DataSet.SetData('db-big.csv') then
  begin
    writeln('Error loading data set.');
  end
  else
  begin
    for i:=0 to DataSet.RowCount-1 do
    begin
      for j:=0 to DataSet.ColCount-1 do
        write(' ',DataSet.Values[j,i]);
      writeln;
    end;
  end;
  DataSet.Free;
  PInfo.Free;
  readln;
end.

