embulk-output-cdata 0.3.0 → 0.3.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: 4403bdc2f1e558cd452acc0fef1d9741cd5971f8
4
- data.tar.gz: e41965e8e79123fc9d09b5bbf44bf856219f56f7
3
+ metadata.gz: 68d9df61354ee1371c25b674abc9645f628a09cc
4
+ data.tar.gz: bd325f4e7ba5d0614ee5ba275131273894a708ed
5
5
  SHA512:
6
- metadata.gz: cfc0e796edb284bb5488c6b80dd560953e7916b2ee3dd5d9ea762b2b8387cbf63d41a79437eca6c9e9df4dd4731d36cd37d6134651d11282f1505feb87ea0332
7
- data.tar.gz: 61ce986620b87e48670dd34d7d3a8ff30b3fb318f3a9048836bcc57997ed030e3adfd5cec16ee39dab0187b99e3c900cb1f3783964702f96c896d6e6667a7756
6
+ metadata.gz: 2a59f5082958068b786731a2c54edd53cf0b71c4b700e4a1c5d9bc93b60223c40e70dd615d048c1bfc276662de9c103169585e9e28781f8197da66c28c6f07b5
7
+ data.tar.gz: 7a46a6475de051f5ff6a63303eb9d870f3667c6bf9f5a6550e6568a8d5bf722b5f1a6cfdd38a4eb656c02139fd89831d45bd00f06596be8c8db7488189937bf3
data/build.gradle CHANGED
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.3.0"
16
+ version = "0.3.3"
17
17
 
18
18
  sourceCompatibility = 1.8
19
19
  targetCompatibility = 1.8
@@ -85,7 +85,7 @@ Gem::Specification.new do |spec|
85
85
  spec.description = %[Dumps records to Cdata.]
86
86
  spec.email = ["m.nishitsuji@gmail.com"]
87
87
  spec.licenses = ["MIT"]
88
- # TODO set this: spec.homepage = "https://github.com/m.nishitsuji/embulk-output-cdata"
88
+ spec.homepage = "https://github.com/datable-inc/embulk-output-cdata"
89
89
 
90
90
  spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
91
91
  spec.test_files = spec.files.grep(%r"^(test|spec)/")
@@ -81,8 +81,11 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
81
81
  @Override
82
82
  public void booleanColumn(Column column) {
83
83
  try {
84
- preparedStatementColumnLogger(column);
85
- preparedStatement.setBoolean(column.getIndex() + 2, pageReader.getBoolean(column));
84
+ if (pageReader.getString(column) == null) {
85
+ preparedStatement.setObject(column.getIndex() + 2, null);
86
+ } else {
87
+ preparedStatement.setBoolean(column.getIndex() + 2, pageReader.getBoolean(column));
88
+ }
86
89
  } catch (SQLException e) {
87
90
  throw new RuntimeException(e);
88
91
  }
@@ -91,8 +94,11 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
91
94
  @Override
92
95
  public void longColumn(Column column) {
93
96
  try {
94
- preparedStatementColumnLogger(column);
95
- preparedStatement.setLong(column.getIndex() + 2, pageReader.getLong(column));
97
+ if (pageReader.getString(column) == null) {
98
+ preparedStatement.setObject(column.getIndex() + 2, null);
99
+ } else {
100
+ preparedStatement.setLong(column.getIndex() + 2, pageReader.getLong(column));
101
+ }
96
102
  } catch (SQLException e) {
97
103
  throw new RuntimeException(e);
98
104
  }
@@ -101,8 +107,11 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
101
107
  @Override
102
108
  public void doubleColumn(Column column) {
103
109
  try {
104
- preparedStatementColumnLogger(column);
105
- preparedStatement.setDouble(column.getIndex() + 2, pageReader.getDouble(column));
110
+ if (pageReader.getString(column) == null) {
111
+ preparedStatement.setObject(column.getIndex() + 2, null);
112
+ } else {
113
+ preparedStatement.setDouble(column.getIndex() + 2, pageReader.getDouble(column));
114
+ }
106
115
  } catch (SQLException e) {
107
116
  throw new RuntimeException(e);
108
117
  }
@@ -111,11 +120,14 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
111
120
  @Override
112
121
  public void stringColumn(Column column) {
113
122
  try {
114
- preparedStatementColumnLogger(column);
115
123
  if (Objects.equals(column.getName(), task.getExternalIdColumn())) {
116
124
  currentExternalIdColumn = pageReader.getString(column);
117
125
  }
118
- preparedStatement.setString(column.getIndex() + 2, pageReader.getString(column));
126
+ if (pageReader.getString(column) == null) {
127
+ preparedStatement.setObject(column.getIndex() + 2, null);
128
+ } else {
129
+ preparedStatement.setString(column.getIndex() + 2, pageReader.getString(column));
130
+ }
119
131
  } catch (SQLException e) {
120
132
  throw new RuntimeException(e);
121
133
  }
@@ -124,8 +136,11 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
124
136
  @Override
125
137
  public void timestampColumn(Column column) {
126
138
  try {
127
- preparedStatementColumnLogger(column);
128
- preparedStatement.setTimestamp(column.getIndex() + 2, Timestamp.from(pageReader.getTimestampInstant(column)));
139
+ if (pageReader.getString(column) == null) {
140
+ preparedStatement.setObject(column.getIndex() + 2, null);
141
+ } else {
142
+ preparedStatement.setTimestamp(column.getIndex() + 2, Timestamp.from(pageReader.getTimestampInstant(column)));
143
+ }
129
144
  } catch (SQLException e) {
130
145
  throw new RuntimeException(e);
131
146
  }
@@ -134,8 +149,11 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
134
149
  @Override
135
150
  public void jsonColumn(Column column) {
136
151
  try {
137
- preparedStatementColumnLogger(column);
138
- preparedStatement.setString(column.getIndex() + 2, pageReader.getString(column));
152
+ if (pageReader.getString(column) == null) {
153
+ preparedStatement.setObject(column.getIndex() + 2, null);
154
+ } else {
155
+ preparedStatement.setString(column.getIndex() + 2, pageReader.getString(column));
156
+ }
139
157
  } catch (SQLException e) {
140
158
  throw new RuntimeException(e);
141
159
  }
@@ -143,7 +161,7 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
143
161
  });
144
162
  String id = idMap.get(currentExternalIdColumn);
145
163
  if (id != null) {
146
- preparedStatement.setString(1, idMap.get(currentExternalIdColumn));
164
+ preparedStatement.setString(1, id);
147
165
  preparedStatement.executeUpdate();
148
166
  logger.info("inserted to Temp#TEMP");
149
167
  } else {
@@ -197,8 +215,4 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
197
215
  public TaskReport commit() {
198
216
  return null;
199
217
  }
200
-
201
- private void preparedStatementColumnLogger(Column column) {
202
- logger.info(column.getName() + ": " + pageReader.getString(column));
203
- }
204
218
  }
@@ -50,7 +50,7 @@ public class CDataPageOutputForUpsert implements TransactionalPageOutput {
50
50
  @Override
51
51
  public void booleanColumn(Column column) {
52
52
  try {
53
- preparedStatementColumnLogger(column);
53
+ logger.info(column.getName() + ": " + pageReader.getBoolean(column));
54
54
  preparedStatement.setBoolean(column.getIndex() + 1, pageReader.getBoolean(column));
55
55
  } catch (SQLException e) {
56
56
  throw new RuntimeException(e);
@@ -60,7 +60,7 @@ public class CDataPageOutputForUpsert implements TransactionalPageOutput {
60
60
  @Override
61
61
  public void longColumn(Column column) {
62
62
  try {
63
- preparedStatementColumnLogger(column);
63
+ logger.info(column.getName() + ": " + pageReader.getLong(column));
64
64
  preparedStatement.setLong(column.getIndex() + 1, pageReader.getLong(column));
65
65
  } catch (SQLException e) {
66
66
  throw new RuntimeException(e);
@@ -70,7 +70,7 @@ public class CDataPageOutputForUpsert implements TransactionalPageOutput {
70
70
  @Override
71
71
  public void doubleColumn(Column column) {
72
72
  try {
73
- preparedStatementColumnLogger(column);
73
+ logger.info(column.getName() + ": " + pageReader.getDouble(column));
74
74
  preparedStatement.setDouble(column.getIndex() + 1, pageReader.getDouble(column));
75
75
  } catch (SQLException e) {
76
76
  throw new RuntimeException(e);
@@ -80,7 +80,7 @@ public class CDataPageOutputForUpsert implements TransactionalPageOutput {
80
80
  @Override
81
81
  public void stringColumn(Column column) {
82
82
  try {
83
- preparedStatementColumnLogger(column);
83
+ logger.info(column.getName() + ": " + pageReader.getString(column));
84
84
  preparedStatement.setString(column.getIndex() + 1, pageReader.getString(column));
85
85
  } catch (SQLException e) {
86
86
  throw new RuntimeException(e);
@@ -90,7 +90,7 @@ public class CDataPageOutputForUpsert implements TransactionalPageOutput {
90
90
  @Override
91
91
  public void timestampColumn(Column column) {
92
92
  try {
93
- preparedStatementColumnLogger(column);
93
+ logger.info(column.getName() + ": " + pageReader.getTimestampInstant(column));
94
94
  preparedStatement.setTimestamp(column.getIndex() + 1, Timestamp.from(pageReader.getTimestampInstant(column)));
95
95
  } catch (SQLException e) {
96
96
  throw new RuntimeException(e);
@@ -100,7 +100,7 @@ public class CDataPageOutputForUpsert implements TransactionalPageOutput {
100
100
  @Override
101
101
  public void jsonColumn(Column column) {
102
102
  try {
103
- preparedStatementColumnLogger(column);
103
+ logger.info(column.getName() + ": " + pageReader.getString(column));
104
104
  preparedStatement.setString(column.getIndex() + 1, pageReader.getString(column));
105
105
  } catch (SQLException e) {
106
106
  throw new RuntimeException(e);
@@ -158,8 +158,4 @@ public class CDataPageOutputForUpsert implements TransactionalPageOutput {
158
158
  public TaskReport commit() {
159
159
  return null;
160
160
  }
161
-
162
- private void preparedStatementColumnLogger(Column column) {
163
- logger.info(column.getName() + ": " + pageReader.getString(column));
164
- }
165
161
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-cdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sampo02
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-20 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ files:
49
49
  - LICENSE.txt
50
50
  - README.md
51
51
  - build.gradle
52
- - classpath/embulk-output-cdata-0.3.0.jar
52
+ - classpath/embulk-output-cdata-0.3.3.jar
53
53
  - config/checkstyle/checkstyle.xml
54
54
  - config/checkstyle/default.xml
55
55
  - gradle/wrapper/gradle-wrapper.jar
@@ -61,7 +61,7 @@ files:
61
61
  - src/main/java/org/embulk/output/cdata/CDataPageOutputForUpdate.java
62
62
  - src/main/java/org/embulk/output/cdata/CDataPageOutputForUpsert.java
63
63
  - src/test/java/org/embulk/output/cdata/TestCDataOutputPlugin.java
64
- homepage:
64
+ homepage: https://github.com/datable-inc/embulk-output-cdata
65
65
  licenses:
66
66
  - MIT
67
67
  metadata: {}