temporary_results.each do |row|
#values << "(#{row.map{|x| curr_db.quote(x) }.join(", ")})"
#values << "(#{row.map{|x| x ? curr_db.quote(x) : x }.join(", ")})"
row_s = row.map{|x| x && x.class == 'String' ? ('"' + x + '"') : x }
#p row
values << "(#{row_s.join(", ")})"
#p values
end
sql_query << "(#{values.join(",\n")})"
выхлоп
"INSERT INTO user_app\n(email, product, country, guid, appid_str, created)\nVALUES\n((jhaynie@appcelerator.com, 4006, US, bd8451ea-272c-4fce-9d06-292582633831, com.appcelerator.memory, 2009-11-21 11:41:23),\n(nospam-appcelerator@turdhead.com, , , ce38b521-e208-4c14-b782-5eb3bf90de10, jj.j, 2009-11-22 13:05:08))"
./analytics_reports:441:in `query': 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 '@appcelerator.com, 4006, US, bd8451ea-272c-4fce-9d06-292582633831, com.appcelera' at line 4 (Mysql::Error)
взято с http://stackoverflow.com/questions/1109993/construct-a-valid-mysql-query-usin...
Что я делаю не так?
эскэйп ('\\«'), dbh.quote не помогают