dbf2mysql没有插入记录

时间:2014-10-24 12:29:49

标签: mysql ubuntu dbf

我正在使用dbf2mysql库http://manpages.ubuntu.com/manpages/natty/man1/dbf2mysql.1.html将一些数据移植到mysql,但是当我尝试查看插入的记录时,没有插入任何内容。

这是我正在运行的命令:

$ dbf2mysql -vvv -q -h localhost -P password -U root smb/C_clist.DBF -d opera_dbf -t pricelists -c
Opening dbf-file smb/C_clist.DBF
dbf-file: smb/C_clist.DBF - Visual FoxPro w. DBC, MySQL-dbase: opera_dbf, MySQL-table: pricelists
Number of records: 12
Name         Length Display  Type
-------------------------------------
CL_CODE               8     0     C
CL_DESC              30     0     C
CL_CURR               3     0     C
CL_FCDEC              1     0     N
Making connection to MySQL-server
Dropping original table (if one exists)
Building CREATE-clause
Sending create-clause
CREATE TABLE pricelists (CL_CODE varchar(8) not null,
    CL_DESC varchar(30) not null,
    CL_CURR varchar(3) not null,
    CL_FCDEC int not null)

fields in dbh 4, allocated mem for query 279, query size 139
Inserting records
Inserting record 0
LOAD DATA LOCAL INFILE '/tmp/d2mygo04TM' REPLACE INTO table pricelists fields terminated by ',' enclosed by ''''
Closing up....

然后在mysql中,使用正确的字段类型创建表,但没有数据:

mysql> use opera_dbf;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> describe pricelists;
+----------+-------------+------+-----+---------+-------+
| Field    | Type        | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| CL_CODE  | varchar(8)  | NO   |     | NULL    |       |
| CL_DESC  | varchar(30) | NO   |     | NULL    |       |
| CL_CURR  | varchar(3)  | NO   |     | NULL    |       |
| CL_FCDEC | int(11)     | NO   |     | NULL    |       |
+----------+-------------+------+-----+---------+-------+
4 rows in set (0.13 sec)

mysql> select * from pricelists;
Empty set (0.00 sec)

mysql> 

我错过了什么?

1 个答案:

答案 0 :(得分:0)

我删除了-q选项,它可以正常工作

-q dbf2mysql:“快速”模式。使用临时文件插入数据               'LOAD DATA INFILE'MySQL声明。这增加了插入               在我的电脑上加速2-2.5倍。还要注意整个'LOAD期间               DATA'受影响的表被锁定。