logstash-input-jdbc 4.1.2 → 4.1.3

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: a78d72e92aa01bf8891190bf7f03fb389f26b59f
4
- data.tar.gz: 014325a08ad778dcc57aafeca4c45978be18abf7
3
+ metadata.gz: 53ec2495d5e7fd90405e7c0b80e1fbf325f819d0
4
+ data.tar.gz: 1792c0903a6cf5943b1f4930ed5d2a6b60a6a9d2
5
5
  SHA512:
6
- metadata.gz: 8d4841251922f7b763a4972e5cd47b8b499f419b4c4771656dea5a769c0bc9484eda5591073b37b34ba46c262b27dfef5b217e8a559aa731c80886bc29f9f9a8
7
- data.tar.gz: c9913e1d5b4b686d085d9875b38a7a27837ba8a327fa3cd4ce326bf5ffab5e24d630cd3a3184e5aea4a6f8a871f338d0a8d249db78295c8e8933d0c645e4cc72
6
+ metadata.gz: 5113d77634809fcac2ee4e1f64c8a5424cfb2626081237b5dff36f85edb8c135c719e9deba8a1945f78cc9ac2fabce2bce33ca39f4bc0a70ee14cfad5fd78da3
7
+ data.tar.gz: c21241ebf26bb0ae9ac69e9c1e9d1c77e486a9a925a3227f10bbf2b7ea3a6b64f2498fb78b0c17179ba867b87b35e8c40bf4dd954903df61da8520870eaeca3e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.1.3
2
+ - Fix part1 of #172, coerce SQL DATE to LS Timestamp
3
+
1
4
  ## 4.1.2
2
5
  - [internal] Removed docker dependencies for testing
3
6
 
@@ -275,6 +275,8 @@ module LogStash::PluginMixins::Jdbc
275
275
  if value.is_a?(Time)
276
276
  # transform it to LogStash::Timestamp as required by LS
277
277
  LogStash::Timestamp.new(value)
278
+ elsif value.is_a?(Date)
279
+ LogStash::Timestamp.new(value.to_time)
278
280
  elsif value.is_a?(DateTime)
279
281
  # Manual timezone conversion detected.
280
282
  # This is slower, so we put it in as a conditional case.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-jdbc'
3
- s.version = '4.1.2'
3
+ s.version = '4.1.3'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "This example input streams a string at a definable interval."
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -33,10 +33,12 @@ describe LogStash::Inputs::Jdbc do
33
33
  String :string
34
34
  DateTime :custom_time
35
35
  end
36
+ db << "CREATE TABLE types_table (num INTEGER, string VARCHAR(255), started_at DATE, custom_time TIMESTAMP, ranking DECIMAL(16,6))"
36
37
  end
37
38
 
38
39
  after :each do
39
40
  db.drop_table(:test_table)
41
+ db.drop_table(:types_table)
40
42
  end
41
43
 
42
44
  context "when registering and tearing down" do
@@ -1042,4 +1044,35 @@ describe LogStash::Inputs::Jdbc do
1042
1044
  end
1043
1045
  end
1044
1046
  end
1047
+
1048
+ context "when fetching Various Typed data" do
1049
+
1050
+ let(:settings) do
1051
+ {
1052
+ "statement" => "SELECT * from types_table"
1053
+ }
1054
+ end
1055
+
1056
+ before do
1057
+ db << "INSERT INTO types_table (num, string, started_at, custom_time, ranking) VALUES (1, 'A test', '1999-12-31', '1999-12-31 23:59:59', 95.67)"
1058
+
1059
+ plugin.register
1060
+ end
1061
+
1062
+ after do
1063
+ plugin.stop
1064
+ end
1065
+
1066
+ it "should convert all columns to valid Event acceptable data types" do
1067
+ plugin.run(queue)
1068
+ event = queue.pop
1069
+ expect(event.get("num")).to eq(1)
1070
+ expect(event.get("string")).to eq("A test")
1071
+ expect(event.get("started_at")).to be_a(LogStash::Timestamp)
1072
+ expect(event.get("started_at").to_s).to eq("1999-12-31T00:00:00.000Z")
1073
+ expect(event.get("custom_time")).to be_a(LogStash::Timestamp)
1074
+ expect(event.get("custom_time").to_s).to eq("1999-12-31T23:59:59.000Z")
1075
+ expect(event.get("ranking").to_f).to eq(95.67)
1076
+ end
1077
+ end
1045
1078
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2016-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement