Bug #13295 Mysqlimport data format option
Submitted: 17 Sep 2005 17:14 Modified: 19 Sep 2005 19:11
Reporter: Sam Yee Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Administrator Severity:S3 (Non-critical)
Version:4.1.12 OS:Linux (Linux-Fedora 2)
Assigned to: CPU Architecture:Any

[17 Sep 2005 17:14] Sam Yee
Description:
The table have empty before running the command. The output have one extra rows of data which is the 'ID" field value 32. By the way... not sure how to specified ' ' as a field separator along with , as well. Hence, imported value on below have 'value' . Thank YOu

the input file is "City.txt":

1,'Kabul','AFG','Kabol',1780000;
2,'Qandahar','AFG','Qandahar',237500;

========

mysql> desc City;
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| ID | int(11) | | PRI | NULL | auto_increment |
| Name | char(35) | | | | |
| CountryCode | char(3) | | | | |
| District | char(20) | | | | |
| Population | int(11) | | | 0 | |
+-------------+----------+------+-----+---------+----------------+
5 rows in set (0.00 sec) 

./mysqlimport --lines-terminated-by=";" --fields-terminated-by="," world2 /home/test/mysql-test/City.txt

mysql> select * from City;
+----+------------+-------------+------------+------------+
| ID | Name | CountryCode | District | Population |
+----+------------+-------------+------------+------------+
| 1 | 'Kabul' | 'AF | 'Kabol' | 1780000 |
| 2 | 'Qandahar' | 'AF | 'Qandahar' | 237500 |
| 32 | | | | 0 |
+----+------------+-------------+------------+------------+
3 rows in set (0.00 sec)

How to repeat:
1. Empty the table "City".(see the table structure on above)

2. Prepaid the "City.txt":
1,'Kabul','AFG','Kabol',1780000;
2,'Qandahar','AFG','Qandahar',237500;
====

3. At shell promt> ./mysqlimport --lines-terminated-by=";" --fields-terminated-by="," world2 /home/test/mysql-test/City.txt
[18 Sep 2005 4:30] Sam Yee
Kindly Ignore Bug #13295.

Have fixed it with :

./mysqlimport -pxxxxx  --lines-terminated-by=";\n" --fields-enclosed-by="'" --fields-terminated-by=","  world2  /home/test/mysql-test/City.txt
[19 Sep 2005 19:11] MySQL Verification Team
Thank you for the feedback.