Hi!
I downloaded the tarball from
http://www.tmtm.org/en/ruby/mysql/
The issue was resolved when i commented following code
retval << {
# Standard Ruby DBI column attributes
'name' => col.name,
'sql_type' => sql_type,
'type_name' => type_name,
'precision' => col.length,
'scale' => col.decimals,
#'nullable' => !col.is_not_null?, (commented by me)
'indexed' => ((col.flags & indexed) != 0),
#||col.is_pri_key?, (commented by
me)
#‘primary’ => col.is_pri_key?, (commented by me)
‘unique’ => ((col.flags & unique_key_flag) != 0),
#||col.is_pri_key?, (commented by
me)
# MySQL-specific attributes (signified by leading
“mysql_”)
‘mysql_type’ => col.type,
‘mysql_type_name’ => mysql_type_name,
‘mysql_length’ => col.length,
‘mysql_max_length’ => col.max_length,
‘mysql_flags’ => col.flags
}
}
Here is the entire stack trace:
c:/ruby/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:662:in
column_info': undefined method
is_not_null?’ for #Mysql::Field:Field
(NoMethodError)
from c:/ruby/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:648:in
each' 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/site_ruby/1.8/DBD/Mysql/Mysql.rb:570: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 dbi-demo.rb:4 from dbi-demo.rb:3:in
each’
from dbi-demo.rb:3
The code by me (This is running perfect when i comment code
as mentioned above)
require "dbi"
new_conn = DBI.connect("DBI:Mysql:summer_development:localhost",
"root", "")
new_conn.tables.each do |table|
all_columns = new_conn.execute("desc #{table}")
for column in all_columns
puts column
end
end