diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-08-27 23:41:29 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-09-11 20:48:50 -0300 |
commit | f13b278568a1d629dd4d90b16ed87b715c4e689d (patch) | |
tree | b97b8d904a17559b952216296a1d28756e303f63 /activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | |
parent | 3d60e9d5503b5f657336a8b7ee6345552ddb6c83 (diff) | |
download | rails-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.rb | 2 |
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) |