tapsoob 0.4.14-java → 0.4.18-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tapsoob/data_stream.rb +4 -4
- data/lib/tapsoob/utils.rb +16 -3
- data/lib/tapsoob/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa7d5a2e1a39c66d9565bd984c5b620fd7ce747425ef20548769030e9915389
|
4
|
+
data.tar.gz: a01c7fcf788caad90d1a6ef77f11efc36dbadafaadffd6cb525085cfc731630d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af51cbe446d59d0b727aa64a5d0a3b67d963d678f45a812a3591b4ea2edfb5e515c2e4c057133ab9e281d9b38a2faaf1b099062ca151904a0732f9ef0f779e97
|
7
|
+
data.tar.gz: 956369b8b67eb9aadbc3222d5bb8a2ad3665c66059b78698cb42445692a0162d552dbc0db2abdcf40e911f69eb4aa9f7b20bbd30a73bdb24a94e8968760b31c8
|
data/lib/tapsoob/data_stream.rb
CHANGED
@@ -75,7 +75,7 @@ module Tapsoob
|
|
75
75
|
state[:chunksize] = fetch_chunksize
|
76
76
|
ds = table.order(*order_by).limit(state[:chunksize], state[:offset])
|
77
77
|
log.debug "DataStream#fetch_rows SQL -> #{ds.sql}"
|
78
|
-
rows = Tapsoob::Utils.format_data(ds.all,
|
78
|
+
rows = Tapsoob::Utils.format_data(db, ds.all,
|
79
79
|
:string_columns => string_columns,
|
80
80
|
:schema => db.schema(table_name),
|
81
81
|
:table => table_name
|
@@ -152,15 +152,15 @@ module Tapsoob
|
|
152
152
|
|
153
153
|
rows = parse_encoded_data(encoded_data, json[:checksum])
|
154
154
|
|
155
|
-
@complete = rows
|
155
|
+
@complete = rows == { }
|
156
156
|
|
157
157
|
# update local state
|
158
158
|
state.merge!(json[:state].merge(:chunksize => state[:chunksize]))
|
159
159
|
|
160
160
|
unless @complete
|
161
161
|
yield rows if block_given?
|
162
|
-
state[:offset] +=
|
163
|
-
|
162
|
+
state[:offset] += rows[:data].size
|
163
|
+
rows[:data].size
|
164
164
|
else
|
165
165
|
0
|
166
166
|
end
|
data/lib/tapsoob/utils.rb
CHANGED
@@ -37,7 +37,7 @@ module Tapsoob
|
|
37
37
|
data.unpack("m").first
|
38
38
|
end
|
39
39
|
|
40
|
-
def format_data(data, opts = {})
|
40
|
+
def format_data(db, data, opts = {})
|
41
41
|
return {} if data.size == 0
|
42
42
|
string_columns = opts[:string_columns] || []
|
43
43
|
schema = opts[:schema] || []
|
@@ -75,7 +75,20 @@ Data : #{data}
|
|
75
75
|
res = { table_name: table, header: header, data: only_data }
|
76
76
|
|
77
77
|
# Add types if schema isn't empty
|
78
|
-
res[:types] = schema.map
|
78
|
+
res[:types] = schema.map do |c|
|
79
|
+
case db.column_schema_to_ruby_type(c.last[:type])[:type]
|
80
|
+
when BigDecimal
|
81
|
+
"float"
|
82
|
+
when :Bignum
|
83
|
+
"integer"
|
84
|
+
when File
|
85
|
+
"blob"
|
86
|
+
when TrueClass
|
87
|
+
"boolean"
|
88
|
+
else
|
89
|
+
db.column_schema_to_ruby_type(c.last[:type])[:type].to_s.downcase
|
90
|
+
end
|
91
|
+
end unless schema.empty?
|
79
92
|
|
80
93
|
res
|
81
94
|
end
|
@@ -144,7 +157,7 @@ Data : #{data}
|
|
144
157
|
data = row_data
|
145
158
|
if File.exists?(File.join(dump_path, "data", "#{table}.json"))
|
146
159
|
previous_data = JSON.parse(File.read(File.join(dump_path, "data", "#{table}.json")))
|
147
|
-
data[:data] = previous_data["data"] + row_data[:data]
|
160
|
+
data[:data] = previous_data["data"] + row_data[:data] unless row_data[:data].nil?
|
148
161
|
end
|
149
162
|
|
150
163
|
File.open(File.join(dump_path, "data", "#{table}.json"), 'w') do |file|
|
data/lib/tapsoob/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapsoob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.18
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Félix Bellanger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|