Ruby-mysql problem

Discussion in 'Ruby' started by George Moschovitis, Jul 15, 2004.

  1. Hello everyone,

    I have a small problem with ruby-mysql.

    lets say I have the following SQL Table:

    CREATE TABLE MyTable
    oid INTEGER,
    pid INTEGER,
    body TEXT
    );

    when I execute a query like this:

    rows = db.query("SELECT * FROM MyTable WHERE oid=2")

    I get back a resultset:

    rows.each { |row|
    puts row[1].class
    }

    I was surprised to see that row[1] is a String and NOT
    a Fixnum, ie the types are lost. Is there any neat solution
    to this problem?

    Thanks in advance for any help!

    George Moschovitis


    --
    www.navel.gr | tel: +30 2106898050 | fax: +30 2106898437

    Navel does not accept liability for any errors, viruses or omissions in
    the contents of this message. The full corporate policy is available on
    our site.
     
    George Moschovitis, Jul 15, 2004
    #1
    1. Advertisements

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. David Heinemeier Hansson
    Replies:
    0
    Views:
    148
    David Heinemeier Hansson
    Aug 9, 2003
  2. Michael campbell
    Replies:
    0
    Views:
    206
    Michael campbell
    Oct 22, 2003
  3. Useko Netsumi

    mysql-ruby for ruby 1.8.1 on windows ...

    Useko Netsumi, Jan 7, 2004, in forum: Ruby
    Replies:
    7
    Views:
    324
    Tim Sutherland
    Jan 10, 2004
  4. Randy Lawrence

    mysql-ruby or ruby-mysql?

    Randy Lawrence, May 23, 2004, in forum: Ruby
    Replies:
    3
    Views:
    252
    Randy Lawrence
    May 24, 2004
  5. anne001
    Replies:
    1
    Views:
    980
  6. Patrick Lynch
    Replies:
    7
    Views:
    196
    Patrick Lynch
    Sep 22, 2006
  7. fg
    Replies:
    1
    Views:
    117
    George Ogata
    Dec 13, 2006
  8. Mark Meijer

    mySQL Ruby Gem and MAMP mySQL

    Mark Meijer, Feb 2, 2008, in forum: Ruby
    Replies:
    3
    Views:
    446
    louis
    Feb 3, 2008
Loading...