MySQL Forums
Forum List  »  Ruby

how to use load command(in mysql) in ruby?
Posted by: peng tao
Date: May 03, 2010 07:35AM

in mysql,it can run:
LOAD DATA LOCAL INFILE "/home/pt/test/bal.csv" INTO TABLE bal FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES;
in my ruby programm:
str="LOAD DATA LOCAL INFILE \"/home/pt/test/bal.csv\" INTO TABLE bal FIELDS TERMINATED BY ',' ENCLOSED BY ' \"' LINES TERMINATED BY '\\n' IGNORE 1 LINES;"
puts str
dbh.query(str)
the output is :
LOAD DATA LOCAL INFILE "/home/pt/test/bal.csv" INTO TABLE bal FIELDS TERMINATED BY ',' ENCLOSED BY ' "' LINES TERMINATED BY '\n' IGNORE 1 LINES;
/home/pt/test/ptb.rb:34:in `query': Field separator argument is not what is expected; check the manual (Mysql::Error)
from /home/pt/test/ptb.rb:34:in `<main>'
what's the matter?

Options: ReplyQuote


Subject
Written By
Posted
how to use load command(in mysql) in ruby?
May 03, 2010 07:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.