From: Pen Ttt on 3 May 2010 09:38 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? -- Posted via http://www.ruby-forum.com/.
From: Brian Candler on 4 May 2010 06:37 Pen Ttt wrote: > ENCLOSED BY ' \"' Did you intend the extra space in there? -- Posted via http://www.ruby-forum.com/.
From: Pen Ttt on 5 May 2010 09:39 Brian Candler wrote: > Pen Ttt wrote: >> ENCLOSED BY ' \"' > > Did you intend the extra space in there? think you ,it must be ENCLOSED BY '\"' -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: Ruby Midwest Conference Early Bird Pricing Next: Bundler gem: "no such file to load" |