tapsoob 0.4.13-java → 0.4.17-java

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
  SHA256:
3
- metadata.gz: 11a4c534d396b9a61d02e8d9723d4b207853e38e9638ec8702533828ac222d6d
4
- data.tar.gz: 440dec8672cb33356b659dca108fcaa48f94b42d8a4a9120081476459184d850
3
+ metadata.gz: 7dde8f342520a6d2dd96362628bdd3d2ccf91fbc3590ee27a1b09e5ad264a4cd
4
+ data.tar.gz: 0e3df729ea764e07bdc1631483892a5313d93b136b4fb7c01392a8de88505ec2
5
5
  SHA512:
6
- metadata.gz: c6182f0faeff1b53db954b2bdd64102ad2d9361dcacff4f057401ab720d1dd7fc09f49bb570c007230eea55ca283f95fd72124a766ebb6ef6452f5d8dbf7e84a
7
- data.tar.gz: 69287437c2161b6ebb5df7f3a0579c7590255249de7251bd047bf654ede3b7102c1605989067a13ef6dcb4477a36c6aa3c0682b55fc515d2201baab7c7857db6
6
+ metadata.gz: e5e2418c63d6be6f1f03252160ce27dc822cc892ae82ee7fa620ca5b9638c103d24577f180a34bd327557bf38e13874f8bb94eaa7245a47d259bc3746a7409a8
7
+ data.tar.gz: 889704b167c445922382e8c379ef1277ccd94d1cb96f4a48e089c7bef878467f5758de981be6ce91a079396b623791b5d5d1cddab29513c2aa51531c99630946
@@ -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[:data] == [ ]
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] += (rows[:data].size.nil? ? 0 : rows[:data].size)
163
- rows[:data].size || 0
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,16 @@ 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 { |c| c.last[:type] } unless schema.empty?
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 File
83
+ "blob"
84
+ else
85
+ db.column_schema_to_ruby_type(c.last[:type])[:type].to_s.downcase
86
+ end
87
+ end unless schema.empty?
79
88
 
80
89
  res
81
90
  end
@@ -144,7 +153,7 @@ Data : #{data}
144
153
  data = row_data
145
154
  if File.exists?(File.join(dump_path, "data", "#{table}.json"))
146
155
  previous_data = JSON.parse(File.read(File.join(dump_path, "data", "#{table}.json")))
147
- data[:data] = previous_data["data"] + row_data[:data]
156
+ data[:data] = previous_data["data"] + row_data[:data] unless row_data[:data].nil?
148
157
  end
149
158
 
150
159
  File.open(File.join(dump_path, "data", "#{table}.json"), 'w') do |file|
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.4.13".freeze
3
+ VERSION = "0.4.17".freeze
4
4
  end
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.13
4
+ version: 0.4.17
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-07-08 00:00:00.000000000 Z
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