struggle 2.3.7 → 2.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/struggle/sql.rb +9 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a89438c6c72b1a4d8bbe6ddc7cc3b1f08f0ee20f
|
4
|
+
data.tar.gz: 1d2d6c93ef994ad1181336fee20b2787fce06385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 426860d803e6bd015244adddb63d7ea3815598b8abccc12da3cc777d56bf7b3ade409b02b503a8d188b2737c46f52ca10337104daa508c307b17436d655ea664
|
7
|
+
data.tar.gz: 057131b1545971cdd33a81d2b9c734cfefec72c9439725ecfdbb93ebe8b54059f36296b061f90df8ce19bfd13ef812e18e190096c48b68a5ea21d20717836835
|
data/lib/struggle/sql.rb
CHANGED
@@ -15,7 +15,7 @@ module Struggle
|
|
15
15
|
# config => {"class_name": ["Member"], "file": "1.sql","adapter": "oracle"}
|
16
16
|
# class_name is ActiveRecord; file is backup sql file
|
17
17
|
def dump(config)
|
18
|
-
|
18
|
+
config["file"] = config["file"].blank? ? "db.sql" : config["file"]
|
19
19
|
config["class_name"].each do |class_name|
|
20
20
|
obj = eval(class_name)
|
21
21
|
obj.all.each do |o|
|
@@ -36,17 +36,14 @@ module Struggle
|
|
36
36
|
end
|
37
37
|
values << value
|
38
38
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
f.close
|
48
|
-
rescue
|
49
|
-
return "#{$!}:#{config["file"]}"
|
39
|
+
begin
|
40
|
+
f = File.new(config["file"], "w+")
|
41
|
+
f.write("INSERT INTO #{obj.table_name} (#{names.join(',')}) VALUES (#{values.join(',')});\r\n")
|
42
|
+
f.close
|
43
|
+
f = nil
|
44
|
+
rescue
|
45
|
+
return "#{$!}:#{config["file"]}"
|
46
|
+
end
|
50
47
|
end
|
51
48
|
end
|
52
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: struggle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iconv
|