activerecord_bulkoperation 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59f7889321cf96c2be699d172e09afa0d74f5c61
4
- data.tar.gz: 32646eef313b3fd12eb076f5fc3d275a7a1b81d8
3
+ metadata.gz: 2fd7b2c2456f8bf5d1522669b3169a97609ede57
4
+ data.tar.gz: 650d94dc039ec2a30509d64f59e98c44cafd0830
5
5
  SHA512:
6
- metadata.gz: 62533c08ace89c06d403a2db76d0e8e1468053b525b041f5cf62378d5b1810560174263f9f8446eb522dcd7eaca9351ed935deb4f95fdb8b4a795a27327acb0b
7
- data.tar.gz: 07944b81ff9f56410432a8b1743d9b9811eee3b78c7e2808878b88325ada7c065fa51d14a749c61a24dc48cc8b4e6a6bd8fc8dae9bc0a1a7a28742e764687e12
6
+ metadata.gz: b7a552c53ab19e865cd000b3182c86b628f73e391e2c512202aaea2d861309ecdcb07576728c78202a757739ace52e15a8f3ae18f91af66d7fbbf99a4133b557
7
+ data.tar.gz: b49271ed11969fb47cb60c614df7d7fa5fde3b93e5313b356a4f337ff891e35e11720d51575bd51fcf95bfdda6478f54c2e5b92002e21a9a42adfef8bce79744
@@ -172,7 +172,7 @@ module ActiveRecord
172
172
 
173
173
  def bind_column(cursor, index, type, column)
174
174
  if type == :string
175
- cursor.bind_param_array(":#{index}", column, String)
175
+ cursor.bind_param_array(":#{index}", column, String, get_max_string_length(column))
176
176
 
177
177
  elsif type == :integer
178
178
  cursor.bind_param_array(":#{index}", column, Fixnum)
@@ -189,6 +189,19 @@ module ActiveRecord
189
189
  end
190
190
  end
191
191
 
192
+ def get_max_string_length(column)
193
+ return nil if column.nil?
194
+
195
+ max_length = 0
196
+
197
+ column.each do |value|
198
+ next if value.nil?
199
+ max_length = value.length if value.length > max_length
200
+ end
201
+
202
+ return max_length > 0 ? max_length : nil
203
+ end
204
+
192
205
  def get_date_type(value)
193
206
  return Date if value.nil?
194
207
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bulkoperation
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_bulkoperation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - OSP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-27 00:00:00.000000000 Z
11
+ date: 2019-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord