我使用mysql ++从csv文件向表中插入数据
mysqlpp::Query insert_query = conn.query("load data local infile 'm_variation_bunrui.csv' INTO TABLE m_variation_bunrui FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n';");
cout <<"Query 1:"<< insert_query <<endl;
mysqlpp::SimpleResult res = insert_query.execute();
cout << res.info() <<endl;
cout << insert_query.error() <<endl;
但它只是说:
Records: 1 Deleted: 0 Skipped: 0 Warnings: 9
我显示已创建的表但没有预期的数据 我的计划有什么问题?
//更新:
我在mysql cmd中检查了命令,它没有像预期的那样工作,所以我修复了它:
load data local infile '/path/to/mycsv.csv' CHARACTER SET 'sjis' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' INTO TABLE m_variation_bunrui(colum1,colum2) ;
再次检查mysql cmd:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHARACTER SET 'sjis' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' INTO TABL' at line 1
请帮我纠正