我通过mysql2 gem访问mysql数据库。
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * from admins' at line 1
)
给我一个错误:
set
如果我排除set功能,它可以工作。如何使用conn.query("SELECT * from admins;"
函数?
=> #<Mysql2::Result:0x00ff8557af200 @query_options={:as=>:hash, :async=>false, :cast_booleans=>false, :symbolize_keys=>false, :database_timezone=>:local, :application_timezone=>nil, :cache_rows=>true, :connect_flags=>bla, :cast=>true, :default_file=>nil, :default_group=>nil, :host=>"bla1", :username=>"bla", :password=>"bla", :database=>"bla", :port=>3007}>
)
->where('worker_print_queue.certification', '=', 'occupations.type');
答案 0 :(得分:0)
尝试:
conn.query("SET @showcurrent = false; SELECT * from admins;")