mysql2json 0.0.2 → 0.0.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/mysql2json.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8348dc9dbbea9baae8f7ba223f466eec3bae9b81
|
4
|
+
data.tar.gz: aff076093abf74b5788ad5acd7bc091c772c6080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8005ca1b0539c86373b35c04f391c3e58ffeff2e14a0d520d582688c34be25329321d9d8b0baac5c960519b4c3edd466b48a490b0008be054de268a41a9fcb09
|
7
|
+
data.tar.gz: dc9ec258788d1ac193a95d93a4b3b090a64cc3902ea01903396188e202acee6e682b8432ff7056aede5d2e53126c4d53808cf9826cc4b0ce7863fcfde012fecd
|
data/lib/mysql2json.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'mysql2'
|
2
2
|
require 'json'
|
3
|
-
require 'net/http'
|
4
3
|
|
5
4
|
def is_json_valid(object)
|
6
5
|
JSON.parse(object)
|
@@ -17,8 +16,11 @@ def convert(results)
|
|
17
16
|
results.each_index do |index|
|
18
17
|
non_json_data.push(results[index]);
|
19
18
|
index += 1
|
20
|
-
puts 'row: '+index.to_s
|
21
|
-
|
19
|
+
puts 'row: '+index.to_s+' parsed'
|
20
|
+
end
|
21
|
+
|
22
|
+
non_json_data.each do |k,v|
|
23
|
+
v.to_s
|
22
24
|
end
|
23
25
|
|
24
26
|
json_data = non_json_data.map { |o| Hash[o.each_pair.to_a] }.to_json
|
@@ -30,7 +32,7 @@ def convert(results)
|
|
30
32
|
end
|
31
33
|
|
32
34
|
return json_data
|
33
|
-
end
|
35
|
+
end
|
34
36
|
|
35
37
|
class Mysql2json
|
36
38
|
def self.query(q, client)
|