embulk-output-cdata 0.2.0 → 0.3.2

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: bc2715c7ddddf01a822d1e0ce110e69f34735059
4
- data.tar.gz: 95a3a102de010090e89e9e57298d11c054a631cf
3
+ metadata.gz: 8a3cdb615898f0b5f980e597a3aac123887e1a0a
4
+ data.tar.gz: 32306e949ade767badffbfc3219e3832ef174349
5
5
  SHA512:
6
- metadata.gz: 3ec3982e296815cf2e2e10db304a2ddcbfb7c382592a21b58e21e0499a391096e80e1bb9b6679dcf98a9da1e95f9574a67e5db9adc4bce196522cf30debbb576
7
- data.tar.gz: 9e28687e5e59a607e0499e048acc23707ebfadc23a9e855dee9dbead9c1a79558bb9e25c4c0dd58714a84782be6ac4edc56c7e4bfa362fd8697dd4126bb085e8
6
+ metadata.gz: 993ca708cdde78f34c5de788610661ea2bee8a3ac1f1096c73c16dea342f6ff25e7aae96581e995db4164c6cb7db3c5c602babf1f9306faa90060b05b70857a6
7
+ data.tar.gz: 74abba526f8ae3800bc66680af429ad0e0900c93a02d2ab4f56b8a1ba5f30b5a4cd086051050c01c0570b1a2902b0a51cb02011a8b6ddebac4866fe7534a2f4e
data/build.gradle CHANGED
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.2.0"
16
+ version = "0.3.2"
17
17
 
18
18
  sourceCompatibility = 1.8
19
19
  targetCompatibility = 1.8
@@ -19,7 +19,7 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
19
19
  private final Connection conn;
20
20
  private final CDataOutputPlugin.PluginTask task;
21
21
  private PreparedStatement preparedStatement;
22
- private String currentExternalColumnId = "";
22
+ private String currentExternalIdColumn = "";
23
23
 
24
24
  public CDataPageOutputForUpdate(final PageReader reader, Connection conn, CDataOutputPlugin.PluginTask task) {
25
25
  this.pageReader = reader;
@@ -81,7 +81,6 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
81
81
  @Override
82
82
  public void booleanColumn(Column column) {
83
83
  try {
84
- preparedStatementColumnLogger(column);
85
84
  preparedStatement.setBoolean(column.getIndex() + 2, pageReader.getBoolean(column));
86
85
  } catch (SQLException e) {
87
86
  throw new RuntimeException(e);
@@ -91,7 +90,6 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
91
90
  @Override
92
91
  public void longColumn(Column column) {
93
92
  try {
94
- preparedStatementColumnLogger(column);
95
93
  preparedStatement.setLong(column.getIndex() + 2, pageReader.getLong(column));
96
94
  } catch (SQLException e) {
97
95
  throw new RuntimeException(e);
@@ -101,7 +99,6 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
101
99
  @Override
102
100
  public void doubleColumn(Column column) {
103
101
  try {
104
- preparedStatementColumnLogger(column);
105
102
  preparedStatement.setDouble(column.getIndex() + 2, pageReader.getDouble(column));
106
103
  } catch (SQLException e) {
107
104
  throw new RuntimeException(e);
@@ -111,9 +108,8 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
111
108
  @Override
112
109
  public void stringColumn(Column column) {
113
110
  try {
114
- preparedStatementColumnLogger(column);
115
111
  if (Objects.equals(column.getName(), task.getExternalIdColumn())) {
116
- currentExternalColumnId = pageReader.getString(column);
112
+ currentExternalIdColumn = pageReader.getString(column);
117
113
  }
118
114
  preparedStatement.setString(column.getIndex() + 2, pageReader.getString(column));
119
115
  } catch (SQLException e) {
@@ -124,7 +120,6 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
124
120
  @Override
125
121
  public void timestampColumn(Column column) {
126
122
  try {
127
- preparedStatementColumnLogger(column);
128
123
  preparedStatement.setTimestamp(column.getIndex() + 2, Timestamp.from(pageReader.getTimestampInstant(column)));
129
124
  } catch (SQLException e) {
130
125
  throw new RuntimeException(e);
@@ -134,16 +129,20 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
134
129
  @Override
135
130
  public void jsonColumn(Column column) {
136
131
  try {
137
- preparedStatementColumnLogger(column);
138
132
  preparedStatement.setString(column.getIndex() + 2, pageReader.getString(column));
139
133
  } catch (SQLException e) {
140
134
  throw new RuntimeException(e);
141
135
  }
142
136
  }
143
137
  });
144
- preparedStatement.setString(1, idMap.get(currentExternalColumnId));
145
- preparedStatement.executeUpdate();
146
- logger.info("inserted to Temp#TEMP");
138
+ String id = idMap.get(currentExternalIdColumn);
139
+ if (id != null) {
140
+ preparedStatement.setString(1, id);
141
+ preparedStatement.executeUpdate();
142
+ logger.info("inserted to Temp#TEMP");
143
+ } else {
144
+ logger.info("skipped insert to Temp#TEMP, currentExternalIdColumn: " + currentExternalIdColumn);
145
+ }
147
146
  } catch (SQLException e) {
148
147
  throw new RuntimeException(e);
149
148
  }
@@ -192,8 +191,4 @@ public class CDataPageOutputForUpdate implements TransactionalPageOutput {
192
191
  public TaskReport commit() {
193
192
  return null;
194
193
  }
195
-
196
- private void preparedStatementColumnLogger(Column column) {
197
- logger.info(column.getName() + ": " + pageReader.getString(column));
198
- }
199
194
  }
@@ -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.2.0
4
+ version: 0.3.2
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-18 00:00:00.000000000 Z
11
+ date: 2022-06-22 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.2.0.jar
52
+ - classpath/embulk-output-cdata-0.3.2.jar
53
53
  - config/checkstyle/checkstyle.xml
54
54
  - config/checkstyle/default.xml
55
55
  - gradle/wrapper/gradle-wrapper.jar