aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-08-27 23:41:29 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-11 20:48:50 -0300
commitf13b278568a1d629dd4d90b16ed87b715c4e689d (patch)
treeb97b8d904a17559b952216296a1d28756e303f63 /activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
parent3d60e9d5503b5f657336a8b7ee6345552ddb6c83 (diff)
downloadrails-f13b278568a1d629dd4d90b16ed87b715c4e689d.tar.gz
rails-f13b278568a1d629dd4d90b16ed87b715c4e689d.tar.bz2
rails-f13b278568a1d629dd4d90b16ed87b715c4e689d.zip
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
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql_adapter.rb2
1 files changed, 1 insertions, 1 deletions
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)