Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > import txt file to mysql with ruby & load data local ??

Reply
Thread Tools

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

 
 
Mike Turco
Guest
Posts: n/a
 
      08-24-2006
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/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting how often the same word appears in a txt file...But my codeonly prints the last line entry in the txt file dgcosgrave@gmail.com Python 8 12-19-2012 06:29 PM
Using Python and Connecting to MySQL remotely WITHOUT MySQL installedon local computer dave Python 4 11-18-2010 04:19 AM
Opening a txt file to view ( i.e. readme.txt) Sameen C++ 2 08-29-2005 03:14 PM
mysql-ruby or ruby-mysql? Randy Lawrence Ruby 3 05-24-2004 03:30 PM
Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock' Allen Marshall Perl Misc 1 01-24-2004 10:55 PM



Advertisments