title: The best solution to process the huge text file data in Delphi 7
body: <p>I have text file like this:</p>
  
  <pre><code>"01","AAA","AAAAA" 
  "02","BBB","BBBBB","BBBBBBBB" 
  "03","CCC" 
  "04","DDD","DDDDD"
  </code></pre>
  
  <p>I want to load this text file data into temp table in sybase db. So, I need to build a program to read line by line this text file until eof. If the text file size is small, the process to read line by line is fast. But if text file size is too big (can be more than 500M), the process read line by line is too slow. I think the read line by line method not suitable for huge text file. So, need to find other solution to load text file data into db instead of read text file line by line method. Any suggestion?
  Example code:</p>
  
  <pre><code>var
    myFile : TextFile;
    text   : string;
  
  begin
    // Try to open the Test.txt file for writing to
    AssignFile(myFile, 'Test.txt');
  
    // Display the file contents
    while not Eof(myFile) do
    begin
      ReadLn(myFile, text);
      TempTable.append;
      TempTable.FieldByName('Field1').asstring=Copy(text,2,2);
      TempTable.FieldByName('Field2').asstring=Copy(text,7,3);
      TempTable.FieldByName('Field3').asstring=Copy(text,13,5);
      TempTable.FieldByName('Field4').asstring=Copy(text,21,8);
      TempTable.post;
    end;
  
    // Close the file for the last time
    CloseFile(myFile);
  end;
  </code></pre>