embulk-output-db2 0.7.12 → 0.7.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/build.gradle +1 -1
- data/classpath/embulk-output-db2-0.7.13.jar +0 -0
- data/classpath/embulk-output-jdbc-0.7.13.jar +0 -0
- data/src/main/java/org/embulk/output/DB2OutputPlugin.java +1 -1
- data/src/main/java/org/embulk/output/db2/DB2OutputConnection.java +2 -48
- data/src/test/java/org/embulk/output/db2/DB2OutputPluginTest.java +1 -1
- metadata +4 -4
- data/classpath/embulk-output-db2-0.7.12.jar +0 -0
- data/classpath/embulk-output-jdbc-0.7.12.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 331aa60059103991dd91737e6cc4a9f2fa4142dc
|
4
|
+
data.tar.gz: 9c63593f5d12959e5b70e6973336360ad32887c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f988d773fafc90e812effc11c4784efb29cddff246270f7c22eddbe3c432d6c8d33716630e15eeeae240aa74479a2ef4bc78d4671698738dbe25b5367e0e095
|
7
|
+
data.tar.gz: 1975548dff57e6dae113c520a57f9789d9cff52cb5095d8e51fa387e4af0060e91cb38f8d1bf3684cb0059127c185ff6bfaff9d32707d851fb25fcf550c3d6e0
|
data/README.md
CHANGED
@@ -18,6 +18,8 @@ DB2 output plugins for Embulk loads records to DB2.
|
|
18
18
|
- **database**: destination database name (string, required)
|
19
19
|
- **schema**: destination schema name (string, default: use the default schema)
|
20
20
|
- **table**: destination table name (string, required)
|
21
|
+
- **create_table_constraint** table constraint added to `CREATE TABLE` statement, like `CREATE TABLE <table_name> (<column1> <type1>, <column2> <type2>, ..., <create_table_constraint>) <create_table_option>`.
|
22
|
+
- **create_table_option** table option added to `CREATE TABLE` statement, like `CREATE TABLE <table_name> (<column1> <type1>, <column2> <type2>, ..., <create_table_constraint>) <create_table_option>`.
|
21
23
|
- **options**: extra connection properties (hash, default: {})
|
22
24
|
- **retry_limit** max retry count for database operations (integer, default: 12)
|
23
25
|
- **retry_wait** initial retry wait time in milliseconds (integer, default: 1000 (1 second))
|
data/build.gradle
CHANGED
Binary file
|
Binary file
|
@@ -65,7 +65,7 @@ public class DB2OutputPlugin
|
|
65
65
|
DB2PluginTask db2Task = (DB2PluginTask) task;
|
66
66
|
|
67
67
|
if (db2Task.getDriverPath().isPresent()) {
|
68
|
-
|
68
|
+
addDriverJarToClasspath(db2Task.getDriverPath().get());
|
69
69
|
}
|
70
70
|
|
71
71
|
String url = String.format(ENGLISH, "jdbc:db2://%s:%d/%s",
|
@@ -2,11 +2,9 @@ package org.embulk.output.db2;
|
|
2
2
|
|
3
3
|
import java.sql.Connection;
|
4
4
|
import java.sql.SQLException;
|
5
|
-
import java.sql.Statement;
|
6
5
|
|
7
6
|
import org.embulk.output.jdbc.JdbcColumn;
|
8
7
|
import org.embulk.output.jdbc.JdbcOutputConnection;
|
9
|
-
import org.embulk.output.jdbc.JdbcSchema;
|
10
8
|
import org.embulk.output.jdbc.TableIdentifier;
|
11
9
|
|
12
10
|
import static java.util.Locale.ENGLISH;
|
@@ -39,53 +37,9 @@ public class DB2OutputConnection
|
|
39
37
|
}
|
40
38
|
|
41
39
|
@Override
|
42
|
-
|
40
|
+
protected boolean supportsTableIfExistsClause()
|
43
41
|
{
|
44
|
-
|
45
|
-
dropTable(table);
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
@Override
|
50
|
-
protected void dropTableIfExists(Statement stmt, TableIdentifier tableName) throws SQLException
|
51
|
-
{
|
52
|
-
if (tableExists(tableName)) {
|
53
|
-
dropTable(stmt, tableName);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
@Override
|
58
|
-
public void createTableIfNotExists(TableIdentifier table, JdbcSchema schema) throws SQLException
|
59
|
-
{
|
60
|
-
if (!tableExists(table)) {
|
61
|
-
createTable(table, schema);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
@Override
|
66
|
-
public void createTable(TableIdentifier table, JdbcSchema schema) throws SQLException
|
67
|
-
{
|
68
|
-
Statement stmt = connection.createStatement();
|
69
|
-
try {
|
70
|
-
String sql = buildCreateTableSql(table, schema);
|
71
|
-
executeUpdate(stmt, sql);
|
72
|
-
commitIfNecessary(connection);
|
73
|
-
} catch (SQLException ex) {
|
74
|
-
throw safeRollback(connection, ex);
|
75
|
-
} finally {
|
76
|
-
stmt.close();
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
@Override
|
81
|
-
protected String buildCreateTableSql(TableIdentifier table, JdbcSchema schema)
|
82
|
-
{
|
83
|
-
StringBuilder sb = new StringBuilder();
|
84
|
-
|
85
|
-
sb.append("CREATE TABLE ");
|
86
|
-
quoteTableIdentifier(sb, table);
|
87
|
-
sb.append(buildCreateTableSchemaSql(schema));
|
88
|
-
return sb.toString();
|
42
|
+
return false;
|
89
43
|
}
|
90
44
|
|
91
45
|
@Override
|
@@ -32,7 +32,7 @@ public class DB2OutputPluginTest extends AbstractJdbcOutputPluginTest
|
|
32
32
|
try {
|
33
33
|
Class.forName("com.ibm.db2.jcc.DB2Driver");
|
34
34
|
} catch (ClassNotFoundException e) {
|
35
|
-
System.err.println("Warning: you should put 'db2jcc4.jar' in 'embulk-output-db2/
|
35
|
+
System.err.println("Warning: you should put 'db2jcc4.jar' in 'embulk-output-db2/test_jdbc_driver' directory in order to test.");
|
36
36
|
return;
|
37
37
|
}
|
38
38
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-db2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Inserts or updates records to a table.
|
14
14
|
email:
|
@@ -19,8 +19,8 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- README.md
|
21
21
|
- build.gradle
|
22
|
-
- classpath/embulk-output-db2-0.7.
|
23
|
-
- classpath/embulk-output-jdbc-0.7.
|
22
|
+
- classpath/embulk-output-db2-0.7.13.jar
|
23
|
+
- classpath/embulk-output-jdbc-0.7.13.jar
|
24
24
|
- lib/embulk/output/db2.rb
|
25
25
|
- out/test/db2/data/test-char.csv
|
26
26
|
- out/test/db2/data/test-datetime.csv
|
Binary file
|
Binary file
|