mysql2json 0.0.3 → 0.0.4
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 +5 -8
- 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: 86428b238d47d3782a9f09cc9e490eedfd245eac
|
4
|
+
data.tar.gz: 97f3c46ac7dc36c0e571c8f4a1d3513a311a16b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd564516b803e856165bf78e4d18edfbb25235354d91587a24541789e5f9fb6c7cba69ce963bd9dd9b23b314fc64cd58d6b110508da7735d0c39030d8d968a46
|
7
|
+
data.tar.gz: 6e0c05f8b1d09de8929a1979cc11129495184e95d504bbbb76ee96f80e2b7faf1e2f70855a8254ffebf2dcfb609870277c18f61ef79662f30a9ea3ec4e7516b9
|
data/lib/mysql2json.rb
CHANGED
@@ -2,10 +2,10 @@ require 'mysql2'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
def is_json_valid(object)
|
5
|
-
|
6
|
-
|
7
|
-
rescue JSON::ParserError
|
8
|
-
|
5
|
+
JSON.parse(object)
|
6
|
+
return true
|
7
|
+
rescue JSON::ParserError
|
8
|
+
return false
|
9
9
|
end
|
10
10
|
|
11
11
|
def convert(results)
|
@@ -42,7 +42,7 @@ class Mysql2json
|
|
42
42
|
|
43
43
|
def self.query_export(q, client, filename)
|
44
44
|
results = client.query(q)
|
45
|
-
convert(results)
|
45
|
+
json_data = convert(results)
|
46
46
|
file = File.open(filename, 'w')
|
47
47
|
file.write(json_data)
|
48
48
|
file.close()
|
@@ -50,6 +50,3 @@ class Mysql2json
|
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|