DanaDanger-data_transport 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -82,9 +82,11 @@ module DataTransport
|
|
82
82
|
end
|
83
83
|
raise(TypeError, "class must descend from ActiveRecord::Base") unless is_active_record
|
84
84
|
# If ignore_errors is true, make sure we're connected to a MySQL
|
85
|
-
# database.
|
85
|
+
# database. We don't use is_a? because if the MySQL adapter isn't
|
86
|
+
# loaded, referencing its class throws a NameError.
|
86
87
|
if @ignore_errors
|
87
|
-
unless @class.connection.
|
88
|
+
unless @class.connection.class.to_s ==
|
89
|
+
"ActiveRecord::ConnectionAdapters::MysqlAdapter"
|
88
90
|
raise ArgumentError, "ignore_errors can only be used with a MySQL database"
|
89
91
|
end
|
90
92
|
end
|
@@ -92,15 +94,17 @@ module DataTransport
|
|
92
94
|
unless options.empty?
|
93
95
|
raise(ArgumentError, "unrecognized options: `#{options.join("', `")}'")
|
94
96
|
end
|
95
|
-
# Figure out how much data the database can handle in one query.
|
97
|
+
# Figure out how much data the database can handle in one query. See
|
98
|
+
# the note above in the ignore_errors compatibility check about using
|
99
|
+
# stringified class names.
|
96
100
|
if @max_sql_length
|
97
101
|
@max_sql_length = @max_sql_length.to_i
|
98
102
|
else
|
99
|
-
case @class.connection
|
100
|
-
when
|
103
|
+
case @class.connection.class.to_s
|
104
|
+
when "ActiveRecord::ConnectionAdapters::MysqlAdapter"
|
101
105
|
rows = @class.connection.select_all("SHOW VARIABLES LIKE 'max_allowed_packet'")
|
102
106
|
@max_sql_length = rows.first["Value"].to_i - 512
|
103
|
-
when ::
|
107
|
+
when /\AActiveRecord::ConnectionAdapters::SQLite3?Adapter\Z/
|
104
108
|
@max_sql_length = 1_000_000
|
105
109
|
else
|
106
110
|
@max_sql_length = 16_777_216
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: DanaDanger-data_transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Danger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|