From f13b278568a1d629dd4d90b16ed87b715c4e689d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 27 Aug 2013 23:41:29 -0300 Subject: Check if the SQL is not a prepared statement When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023 --- activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb') diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 15b5452850..c65ec5559f 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -283,7 +283,7 @@ module ActiveRecord # always be empty, since the bind variables will have been already # substituted and removed from binds by BindVisitor, so this will # effectively disable prepared statement usage completely. - if binds.empty? + if without_prepared_statement?(binds) result_set, affected_rows = exec_without_stmt(sql, name) else result_set, affected_rows = exec_stmt(sql, name, binds) -- cgit v1.2.3