我正在尝试编写如下准备好的声明:
@fofs = FileOrFolder.connection.select_all("select * from newtestdocB.file_or_folders where name like","%#{params[:search]}%")
原来是mysql控制台上的错误查询。不接受变量 %#{params[:search]}% 的值进行查询
请更正我的查询...
控制台消息:
Parameters: {"search"=>"do", "cluster_id"=>"2", "datasetid"=>"1", "id"=>"1"}
%do% (0.2ms) select * from newtestdocB.file_or_folders where name like
ActiveRecord::StatementInvalid (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 '' at line 1: select * from newtestdocB.file_or_folders where name like):