Import txt file to mysql with ruby & load data local?

I'm trying to run this sql from within a ruby program

LOAD DATA LOCAL INFILE 'C:\\test.txt' INTO TABLE `links` FIELDS
TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY
'\r\n'
will this even work with ruby? what should syntax be?

require "rubygems"
require "mysql"

begin

        dbName = "testdb"
        m = Mysql.new("localhost", "root", "")
        m.select_db(dbName)
        result = m.query(???)
        puts "done"
end

??

···

--
Posted via http://www.ruby-forum.com/.

Mike Turco wrote:

I'm trying to run this sql from within a ruby program

LOAD DATA LOCAL INFILE 'C:\\test.txt' INTO TABLE `links` FIELDS
TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY
'\r\n'
will this even work with ruby?

Yes, if it will work with MySQL directly, it should work here as well.

what should syntax be?

It should be valid MySQL syntax. Why not do some experiments?

If you have valid MySQL strings, strings that created what you expected from
past experience, those strings will work here as well.

You can always test your syntax in advance using the command-line mysql
interface:

$ echo "string of MySQL commands;" | mysql -u $USER -p (password)

Basically, this question is more about MySQL than it is about Ruby. Chances
are your valid strings will work with Ruby's MySQL interface.

Maybe some experimentation is in order.

···

--
Paul Lutus
http://www.arachnoid.com