Hey Folks,
New here and to Ruby. Need some help trying to get a MySQL infile
command to work in Ruby:
dbh = Mysql.real_connect(“localhost”, “user”, “pass”, “db_test”)
dbh.query(“LOAD DATA LOCAL INFILE ‘C:\test.csv’ INTO TABLE
db_test.tbl_testing FIELDS TERMINATED BY ‘,’ ENCLOSED BY '”’ LINES
TERMINATED BY ‘\r\n’(data1,data2)
")
printf “%d rows were inserted\n”, dbh.affected_rows
However when I run the program it returns an error:
…LINES TERMINATED BY ‘\r\n’…
^
testcsv.rb:3: unterminated string meets end of file
Any ideas as to how to get around this issue… I’m assuming it has to
do with the \r\n … i’ve tried to use \r\n to no avail…
Thanks!
Amir…