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

Discussion in 'Ruby' started by Mike Turco, Aug 24, 2006.

  1. Mike Turco

    Mike Turco Guest

    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, Aug 24, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sameen
    Replies:
    2
    Views:
    425
    Victor Bazarov
    Aug 29, 2005
  2. dave
    Replies:
    4
    Views:
    1,354
    Steve Holden
    Nov 18, 2010
  3. Jochen Brenzlinger
    Replies:
    7
    Views:
    5,488
    Roedy Green
    Sep 15, 2011
  4. Randy Lawrence

    mysql-ruby or ruby-mysql?

    Randy Lawrence, May 23, 2004, in forum: Ruby
    Replies:
    3
    Views:
    102
    Randy Lawrence
    May 24, 2004
  5. Allen Marshall
    Replies:
    1
    Views:
    184
    Gunnar Hjalmarsson
    Jan 24, 2004
Loading...

Share This Page