condition 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/condition/storage/db.rb +19 -6
- data/lib/condition/version.rb +1 -1
- data/spec/condition_spec.rb +3 -0
- data/spec/files/t_user.ods +0 -0
- 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: 4efc0bb2d9b80f86950bd7ebe239e260bd97ee43
|
4
|
+
data.tar.gz: 73de7c70c3b57b69b0fad5a5e12a2415c285ac91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e26a2d334a4baa197679ac86c11e98fe1c23cb9501ea955d33553abdaccc1e83fff3bfc7ae2f4ab9acf91b5b8d664e3411a3fbad6475436f20b61c9cb8570049
|
7
|
+
data.tar.gz: c5e7b8edda09eb46c5788124cc240da3857c1adc039b83b5c0bacc10e2132772cb2bacc7d703686c4ab44da999d6b536ecfa56d3c5e4f581c2e53c064c7ce9e2
|
data/README.md
CHANGED
data/lib/condition/storage/db.rb
CHANGED
@@ -17,12 +17,25 @@ module Condition
|
|
17
17
|
|
18
18
|
def insert(param_item, default)
|
19
19
|
default_item = default.item(param_item.name) if default
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
prms = default_item ? default_item.params.merge(param_item.params) : param_item.params
|
21
|
+
i1 = ''
|
22
|
+
i2 = ''
|
23
|
+
prms.each_pair do |k, v|
|
24
|
+
if i1 != ''
|
25
|
+
i1 = i1 + ', '
|
26
|
+
i2 = i2 + ', '
|
27
|
+
end
|
28
|
+
i1 = i1 + k.to_s
|
29
|
+
i2 = i2 + '?'
|
30
|
+
end
|
31
|
+
sql = "INSERT INTO #{param_item.name.to_s} (#{i1}) VALUES (#{i2})"
|
24
32
|
param_item.values.each do |it|
|
25
|
-
|
33
|
+
prms = default_item ? default_item.value.merge(it) : it
|
34
|
+
ary = [sql]
|
35
|
+
prms.each_pair do |k, v|
|
36
|
+
ary << v
|
37
|
+
end
|
38
|
+
@db.fetch(*ary).insert
|
26
39
|
end
|
27
40
|
end
|
28
41
|
|
@@ -33,4 +46,4 @@ module Condition
|
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
36
|
-
end
|
49
|
+
end
|
data/lib/condition/version.rb
CHANGED
data/spec/condition_spec.rb
CHANGED
@@ -5,6 +5,9 @@ describe Condition do
|
|
5
5
|
DB << "DROP TABLE IF EXISTS t_test"
|
6
6
|
DB << "CREATE TABLE t_user(user_id BIGINT, user_name TEXT, login_ts TIMESTAMPTZ NOT NULL)"
|
7
7
|
DB << "CREATE TABLE t_test(id BIGINT, name TEXT, flag BOOLEAN, ts TIMESTAMPTZ, iary BIGINT[], tary TEXT[], test_name TEXT NOT NULL)"
|
8
|
+
DB << "CREATE SCHEMA IF NOT EXISTS history"
|
9
|
+
DB << "DROP TABLE IF EXISTS history.t_user"
|
10
|
+
DB << "CREATE TABLE history.t_user(user_id BIGINT, user_name TEXT, login_ts TIMESTAMPTZ NOT NULL)"
|
8
11
|
|
9
12
|
converter = Condition::Reader::ConvertSheet.new(REDIS)
|
10
13
|
converter.convert_dir(FILES, with_dir_name: false)
|
data/spec/files/t_user.ods
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: condition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aoyagikouhei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|