tapsoob 0.4.16 → 0.4.20

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: ea5e38605bcb12459e67b935a39305f0f4aacd5763a7dd9a102055b550c4f006
4
- data.tar.gz: 39a58824d38f9ab13e459a5148ee4696bf7167c0e7ef5c0c425c4c0d092540f3
3
+ metadata.gz: 79b18217fd7c7994e1f04114b221d4d6ae5978ef635579b4084f61793e50aaca
4
+ data.tar.gz: 8bc1dc2b991ae391853d8b4ff136c166041e65fb3f294f7b36f9d97b1f528d46
5
5
  SHA512:
6
- metadata.gz: 17a3ba3498cf03661399cd2109a274f8742bfaf93fc918b856463c21f2da36177af1754d3d9c40f4758b753b7e332564f79f359fa97b9fc8e0e9d34b07d4fdb5
7
- data.tar.gz: bc1c393e88b89504e83aeb85fb8e347380c2bfae86eea01841adbd58108f82094c67dfae7e309b45dcd7838807d83e2fd081c45fb5747648948303dc1eca3cd4
6
+ metadata.gz: d39b453ee5c8efe5f9ff39f8b733a4bc16c34c11034b7fed2ac8fe5f56daac8138b249c85d0d0ccae5c0e07314f1afdb67a71a7872481ba64a76a39e089454c2
7
+ data.tar.gz: 2517ad83634ad03c1c9ab30292cb32596a73ba70cb77af83cb6cf3abbcb32bbb7e2c1d76f18b2e143e5a1cb41c4095464c101de915c50bc33ef27c6a60257028
@@ -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
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,21 @@ 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
+ db.extension :schema_dumper # Add schema dumper extension in case it hasn't been added until now
79
+ res[:types] = schema.map do |c|
80
+ case db.column_schema_to_ruby_type(c.last)[:type]
81
+ when BigDecimal
82
+ "float"
83
+ when :Bignum
84
+ "integer"
85
+ when File
86
+ "blob"
87
+ when TrueClass
88
+ "boolean"
89
+ else
90
+ db.column_schema_to_ruby_type(c.last)[:type].to_s.downcase
91
+ end
92
+ end unless schema.empty?
79
93
 
80
94
  res
81
95
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.4.16".freeze
3
+ VERSION = "0.4.20".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.16
4
+ version: 0.4.20
5
5
  platform: ruby
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
  name: ripl