embulk-input-jdbc 0.5.0 → 0.6.0

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: 58343b1cbca7d7302990e5ae707abd6093c50a6e
4
- data.tar.gz: 1f20480bd02215e50e9e297ab71b8edbf7737f1a
3
+ metadata.gz: a21cec9ce3a1a38d3328338e06044dfd492f47f7
4
+ data.tar.gz: 1e306f57cda5959b21bfd6ccfa71415181297259
5
5
  SHA512:
6
- metadata.gz: a79c9b92ca7b98df26ad863382a8351266b1acaebfb218429000e47132a081afe692f3ba2f543bbb6a2bf768e2eba756cc4fe510c184eb941858ca04fd9e854f
7
- data.tar.gz: cf26a3cbf0ece3949506e6ac9f282eb08c338f39bb9b1cb929b09a2bad9fcaf5d3d08703090dea09a27ebe740cb562382dc55422acf06f9776adfd916abcfb7b
6
+ metadata.gz: d07d396a4ae59a862b2bb53f94d1246d5c3b98306465b2f2e0ee0778a4517697fca874dd381c115e77f03d91db7fd1ce47978d600ace53136fea9ffadccdf60b
7
+ data.tar.gz: a09e9719778a2ec55f3506cb56a345288ab944194623b9a7dd5f116748c33dc90c75f0e9219f53442bcdd629e160b66dd170f16e701bc07f6164ef75c7bea7ef
@@ -2,7 +2,6 @@ package org.embulk.input.jdbc;
2
2
 
3
3
  import java.util.List;
4
4
  import java.util.Map;
5
- import java.util.Properties;
6
5
  import java.nio.file.Paths;
7
6
  import java.sql.ResultSet;
8
7
  import java.sql.SQLException;
@@ -23,12 +22,12 @@ import org.embulk.config.ConfigInject;
23
22
  import org.embulk.config.ConfigSource;
24
23
  import org.embulk.config.Task;
25
24
  import org.embulk.config.TaskSource;
25
+ import org.embulk.plugin.PluginClassLoader;
26
26
  import org.embulk.spi.BufferAllocator;
27
27
  import org.embulk.spi.Column;
28
28
  import org.embulk.spi.PageBuilder;
29
29
  import org.embulk.spi.InputPlugin;
30
30
  import org.embulk.spi.PageOutput;
31
- import org.embulk.spi.PluginClassLoader;
32
31
  import org.embulk.spi.Schema;
33
32
  import org.embulk.spi.Exec;
34
33
  import org.embulk.input.jdbc.getter.ColumnGetter;
@@ -45,7 +44,7 @@ public abstract class AbstractJdbcInputPlugin
45
44
  {
46
45
  @Config("options")
47
46
  @ConfigDefault("{}")
48
- public Properties getOptions();
47
+ public ToStringMap getOptions();
49
48
 
50
49
  @Config("table")
51
50
  @ConfigDefault("null")
@@ -0,0 +1,54 @@
1
+ package org.embulk.input.jdbc;
2
+
3
+ import com.google.common.base.Optional;
4
+ import com.fasterxml.jackson.databind.JsonNode;
5
+ import com.fasterxml.jackson.databind.JsonMappingException;
6
+ import com.fasterxml.jackson.databind.node.NullNode;
7
+ import com.fasterxml.jackson.annotation.JsonCreator;
8
+ import com.fasterxml.jackson.annotation.JsonValue;
9
+
10
+ public class ToString
11
+ {
12
+ private final String string;
13
+
14
+ public ToString(String string)
15
+ {
16
+ this.string = string;
17
+ }
18
+
19
+ @JsonCreator
20
+ ToString(Optional<JsonNode> option) throws JsonMappingException
21
+ {
22
+ JsonNode node = option.or(NullNode.getInstance());
23
+ if (node.isTextual()) {
24
+ this.string = node.textValue();
25
+ } else if (node.isValueNode()) {
26
+ this.string = node.toString();
27
+ } else {
28
+ throw new JsonMappingException(String.format("Arrays and objects are invalid: '%s'", node));
29
+ }
30
+ }
31
+
32
+ @Override
33
+ public boolean equals(Object obj)
34
+ {
35
+ if (!(obj instanceof ToString)) {
36
+ return false;
37
+ }
38
+ ToString o = (ToString) obj;
39
+ return string.equals(o.string);
40
+ }
41
+
42
+ @Override
43
+ public int hashCode()
44
+ {
45
+ return string.hashCode();
46
+ }
47
+
48
+ @JsonValue
49
+ @Override
50
+ public String toString()
51
+ {
52
+ return string;
53
+ }
54
+ }
@@ -0,0 +1,36 @@
1
+ package org.embulk.input.jdbc;
2
+
3
+ import java.util.Map;
4
+ import java.util.HashMap;
5
+ import java.util.Properties;
6
+ import com.google.common.base.Function;
7
+ import com.google.common.collect.Maps;
8
+ import com.fasterxml.jackson.annotation.JsonCreator;
9
+ import com.fasterxml.jackson.annotation.JsonValue;
10
+
11
+ // TODO copied from embulk-output-jdbc. Move this class to embulk-core spi.unit.
12
+ public class ToStringMap
13
+ extends HashMap<String, String>
14
+ {
15
+ @JsonCreator
16
+ ToStringMap(Map<String, ToString> map)
17
+ {
18
+ super(Maps.transformValues(map, new Function<ToString, String>() {
19
+ public String apply(ToString value)
20
+ {
21
+ if (value == null) {
22
+ return "null";
23
+ } else {
24
+ return value.toString();
25
+ }
26
+ }
27
+ }));
28
+ }
29
+
30
+ public Properties toProperties()
31
+ {
32
+ Properties props = new Properties();
33
+ props.putAll(this);
34
+ return props;
35
+ }
36
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-17 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from a table.
14
14
  email:
@@ -25,6 +25,8 @@ files:
25
25
  - src/main/java/org/embulk/input/jdbc/JdbcColumnOption.java
26
26
  - src/main/java/org/embulk/input/jdbc/JdbcInputConnection.java
27
27
  - src/main/java/org/embulk/input/jdbc/JdbcSchema.java
28
+ - src/main/java/org/embulk/input/jdbc/ToString.java
29
+ - src/main/java/org/embulk/input/jdbc/ToStringMap.java
28
30
  - src/main/java/org/embulk/input/jdbc/getter/AbstractColumnGetter.java
29
31
  - src/main/java/org/embulk/input/jdbc/getter/AbstractTimestampColumnGetter.java
30
32
  - src/main/java/org/embulk/input/jdbc/getter/BigDecimalColumnGetter.java
@@ -38,7 +40,7 @@ files:
38
40
  - src/main/java/org/embulk/input/jdbc/getter/StringColumnGetter.java
39
41
  - src/main/java/org/embulk/input/jdbc/getter/TimeColumnGetter.java
40
42
  - src/main/java/org/embulk/input/jdbc/getter/TimestampColumnGetter.java
41
- - classpath/embulk-input-jdbc-0.5.0.jar
43
+ - classpath/embulk-input-jdbc-0.6.0.jar
42
44
  homepage: https://github.com/embulk/embulk-input-jdbc
43
45
  licenses:
44
46
  - Apache 2.0