tapsoob 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tapsoob/utils.rb +15 -4
- data/lib/tapsoob/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5483bf6fead82a0cc2b5392b841abbf19b5bbb99d9a1137f817ede99a1012e3
|
|
4
|
+
data.tar.gz: 0f33862c44439dffe48680e25fe0dbbdcba6a1efc0846dd961049a91512dca30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 750cc687fcc1f63f11c4e1b27c7701c5e00e40bc351dac3245df6fd428abadb91f601633b6e37780a6d83311787b7bae91713004528bbe4500e1cbefcb157c5c
|
|
7
|
+
data.tar.gz: 1f5224ae3b8b5bdbd4df9f164932632db9201ec656639c90ba2b6519b5483d62fd66ebd3d87a0847e1e7b2b5bff647608118494e5b07da44d43a68a211ebbaec
|
data/lib/tapsoob/utils.rb
CHANGED
|
@@ -98,8 +98,6 @@ Data : #{data}
|
|
|
98
98
|
# this is not true for other databases so we must check if the field is
|
|
99
99
|
# actually text and manually convert it back to a string
|
|
100
100
|
def incorrect_blobs(db, table)
|
|
101
|
-
return [] if (db.url =~ /(mysql|mysql2):\/\//).nil?
|
|
102
|
-
|
|
103
101
|
columns = []
|
|
104
102
|
db.schema(table).each do |data|
|
|
105
103
|
column, cdata = data
|
|
@@ -109,10 +107,23 @@ Data : #{data}
|
|
|
109
107
|
end
|
|
110
108
|
|
|
111
109
|
def encode_blobs(row, columns)
|
|
112
|
-
|
|
110
|
+
# Encode columns known to be blobs
|
|
113
111
|
columns.each do |c|
|
|
114
|
-
|
|
112
|
+
if row[c].is_a?(Sequel::SQL::Blob)
|
|
113
|
+
row[c] = base64encode(row[c]) unless row[c].nil?
|
|
114
|
+
elsif !row[c].nil? && row[c].encoding == Encoding::ASCII_8BIT
|
|
115
|
+
# Handle binary data that might not be wrapped in Sequel::SQL::Blob
|
|
116
|
+
row[c] = base64encode(row[c])
|
|
117
|
+
end
|
|
118
|
+
end unless columns.size == 0
|
|
119
|
+
|
|
120
|
+
# Also check all values for Sequel::SQL::Blob objects that might not be in the columns list
|
|
121
|
+
row.each do |key, value|
|
|
122
|
+
if value.is_a?(Sequel::SQL::Blob) && !columns.include?(key)
|
|
123
|
+
row[key] = base64encode(value)
|
|
124
|
+
end
|
|
115
125
|
end
|
|
126
|
+
|
|
116
127
|
row
|
|
117
128
|
end
|
|
118
129
|
|
data/lib/tapsoob/version.rb
CHANGED