Ensure the #max_allowed_packet method exists for the MysqlAdapters.
https://github.com/zdennis/activerecord-import/issues#issue/12
This commit is contained in:
parent
1175bafe0e
commit
cb6b726eac
2 changed files with 38 additions and 1 deletions
|
@ -6,7 +6,16 @@ module ActiveRecord::Import::MysqlAdapter
|
|||
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Returns the maximum number of bytes that the server will allow
|
||||
# in a single packet
|
||||
def max_allowed_packet # :nodoc:
|
||||
result = execute( "SHOW VARIABLES like 'max_allowed_packet';" )
|
||||
# original Mysql gem responds to #fetch_row while Mysql2 responds to #first
|
||||
val = result.respond_to?(:fetch_row) ? result.fetch_row[1] : result.first[1]
|
||||
val.to_i
|
||||
end
|
||||
|
||||
# Returns a generated ON DUPLICATE KEY UPDATE statement given the passed
|
||||
# in +args+.
|
||||
def sql_for_on_duplicate_key_update( table_name, *args ) # :nodoc:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue