diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-03 16:58:13 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-03 17:06:55 +0900 |
commit | 1799d9103555a6c33f1239ae59bc3ced764826cc (patch) | |
tree | 266bbec6b450d13b276b42aa5e9eae3ce8a4cc77 /activerecord | |
parent | 7020c6f9721c36616e58cba344549183aa091233 (diff) | |
download | rails-1799d9103555a6c33f1239ae59bc3ced764826cc.tar.gz rails-1799d9103555a6c33f1239ae59bc3ced764826cc.tar.bz2 rails-1799d9103555a6c33f1239ae59bc3ced764826cc.zip |
`bytes_margin` is only needed when `previous_packet` exists
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb index 1199c0ad1b..a14394fe04 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb @@ -145,15 +145,12 @@ module ActiveRecord elsif previous_packet.nil? true else - (current_packet.bytesize + previous_packet.bytesize) > max_allowed_packet + (current_packet.bytesize + previous_packet.bytesize + 2) > max_allowed_packet end end def max_allowed_packet - @max_allowed_packet ||= begin - bytes_margin = 2 - show_variable("max_allowed_packet") - bytes_margin - end + @max_allowed_packet ||= show_variable("max_allowed_packet") end def exec_stmt_and_free(sql, name, binds, cache_stmt: false) |