Problem with LOAD DATA LOCAL INFILE

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
towerbase
Posts: 1
Joined: Tue 11 Oct 2005 15:35

Problem with LOAD DATA LOCAL INFILE

Post by towerbase » Wed 12 Oct 2005 06:13

There appears to be a problem with LOAD DATA LOCAL INFILE in the dbExpress driver for MySQL. I am using the Windows version.

The first field of the first record that is imported is corrupted with the name of the text file that is being loaded. It looks like a buffer is not being initialised.

The problem can be demonstrated quite easily. Drop a TSQLConnection, TSQLDataSet and TButton on a form. Create a table as follows:
CREATE TABLE corelab ( name VARCHAR(40), id INT)
Create a text file called c:\corelab.txt containing these lines:
line1;1
line2;2

The TButton Click handler should contain code like this:

Code: Select all

  SQLDataSet1.CommandText := 'LOAD DATA LOCAL INFILE ' +
                             '"c:\corelab.txt" ' +
                             'INTO TABLE corelab ' +
                             'FIELDS TERMINATED BY ";" ' +
                             'LINES TERMINATED BY "\r\n"';
  SQLDataSet1.ExecSQL(TRUE);

  SQLDataSet1.CommandText := 'SELECT * FROM corelab';
  SQLDataSet1.Open;
  ShowMessage ( SQLDataSet1.Fields[0].AsString );
The ShowMessage displays
corelab.txtLine 1

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 13 Oct 2005 06:58

Thank you for information.
We reproduced your problem and fixed it. This fix will be included in the next DbxMda build. It will be available on next week.
Please look forward for announcments at the forum.

Post Reply