Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Axel Plinge
RE: column_info undefined method '[]' for XP [ reply ]  
2007-08-14 21:18
Jup, this happens on my ubuntu server as well.
But its is type == 246, not 253 as with Aaron.

I worked around by catching illegal col.types writing

mysql_type_name = Database::TYPE_MAP.key?(col.type) ? Database::TYPE_MAP[col.type][0] : 'UNKNOWN'
and
type_symbol = Database::TYPE_MAP.key?(type) ? Database::TYPE_MAP[type][1] : :as_str

instead of

mysql_type_name = Database::TYPE_MAP[col.type][0]
and
type_symbol = Database::TYPE_MAP[type][1] || :as_str

However, the source of this problem seems to be somewhere in "fetch_fields" or else.

Cheers,

Axel

By: Aaron Harnly
RE: column_info undefined method '[]' for XP [ reply ]  
2006-09-05 20:31
I'm not certain it's the same error, but in OS X I was getting a similar problem with "undefined method[] for nil:nilClass." I could resolve it by inserting the following into line 319 of the Mysql.rb file referenced in the message:

TYPE_MAP[253] = ['VARCHAR', :as_str]
just after the line
TYPE_MAP[nil] = ['VARCHAR', :as_str]

Hope that helps.

By: Yue Teng Lee
column_info undefined method '[]' for XP [ reply ]  
2006-08-29 05:43
I have been having some problems running queries on my setup. Suppose I
have a table dblist. If I run the query:

res = dbh.query( "SELECT cust_desc1 FROM dblist" )

then it is OK. But if I do:

res = dbh.query( "SELECT * FROM dblist" )

I will get the following error message:

c:/ruby/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:649:in
`column_info': undefined method `[]' for nil:NilClass (NoMethodError)
from c:/ruby/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:648:in
`column_info'
from c:/ruby/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:573:in
`execute'
from c:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize'
from c:/ruby/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:570:in
`execute'
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:888:in `execute'
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:480:in `execute'
from testdbi.rb:43

The same SQL statement, if executed using the Ruby MySQL module
instead of the DBI module, is fine.

My setup is as follow:

OS: Windows XP Pro SP2
MySQL: Version 5.0.12
Ruby: 1.8.4
Ruby MySQL module: van Domburg's MqSQL/Ruby for Windows version 2.7
R1

Would appreciate if someone could explain the error to me.

Many thanks.

Yue Teng