使用 mysql2 gem 时获取“local”:参数超出范围(ArgumentError)
我正在尝试使用 mysql2 适配器和 ruby 192 来获取“自动增量”。我的代码是
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': argument out范围(ArgumentError)
但是如果我将查询更改为
result = ActiveRecord::Base.connection.execute "select * from users"
它,它就可以完美地工作, 有什么想法吗?
I am trying to get 'Auto_increment' using mysql2 adapter with ruby 192. my code is
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'"
whenever I am trying to print the fields and data using a loop, it gives me this error -
`local': argument out of range (ArgumentError)
But if I change my query to
result = ActiveRecord::Base.connection.execute "select * from users"
it works perfectly,
any Idea ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论