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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0873720de10377eb9430e59c174227923848a9f
4
- data.tar.gz: f3c850d201e4136536c2be145b1bf1b349287092
3
+ metadata.gz: 4efc0bb2d9b80f86950bd7ebe239e260bd97ee43
4
+ data.tar.gz: 73de7c70c3b57b69b0fad5a5e12a2415c285ac91
5
5
  SHA512:
6
- metadata.gz: 75ebd5305230b36772686de80db2560407b9093cdef8c4b65f48670a94d7004aa991d9d153d8bae1b4f369293498d3764c24a25fea3cedb5b5fc28c6312c851f
7
- data.tar.gz: 6d298975bf3d9645e0802b6af2cac8fa9c2be0c7819ac5458c989eb146a63dcb5ad5bca2c33fd9ecac5e64c885bde4915e45dae7321c1d5635186a77785ad0a1
6
+ metadata.gz: e26a2d334a4baa197679ac86c11e98fe1c23cb9501ea955d33553abdaccc1e83fff3bfc7ae2f4ab9acf91b5b8d664e3411a3fbad6475436f20b61c9cb8570049
7
+ data.tar.gz: c5e7b8edda09eb46c5788124cc240da3857c1adc039b83b5c0bacc10e2132772cb2bacc7d703686c4ab44da999d6b536ecfa56d3c5e4f581c2e53c064c7ce9e2
data/README.md CHANGED
@@ -30,6 +30,9 @@ TODO: Write usage instructions here
30
30
 
31
31
  ## Changes
32
32
 
33
+ 2014-01-15 0.0.25
34
+ support schema name in pre condition
35
+
33
36
  2014-01-08 0.0.24
34
37
  add now() and now(diff seconds)
35
38
 
@@ -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
- ds = @db[param_item.name.to_sym].prepare(
21
- :insert,
22
- :insert_with_name,
23
- default_item ? default_item.params.merge(param_item.params) : param_item.params)
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
- ds.call(default_item ? default_item.value.merge(it) : it)
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
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module Condition
4
- VERSION = "0.0.24"
4
+ VERSION = "0.0.25"
5
5
  end
@@ -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)
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.24
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-08 00:00:00.000000000 Z
11
+ date: 2014-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler