我正在尝试使用带有ruby 192的mysql2适配器获取'Auto_increment'。我的代码是
require 'mysql2'
require 'active_record'
ActiveRecord::Base.establish_connection( :adapter => 'mysql2', :database => 'my_db', :username => 'root', :password => '' )
result = ActiveRecord::Base.connection.execute "SHOW TABLE STATUS LIKE 'users'"
每当我尝试使用循环打印字段和数据时,它都会给我这个错误 -
`local':参数超出范围(ArgumentError)
但如果我将查询更改为
result = ActiveRecord::Base.connection.execute "select * from users"
效果很好, 任何想法?