embulk-output-db2 0.7.12 → 0.7.13

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: 27f8e8c0713e1cbfcd9a0c753e6609b69f0626c3
4
- data.tar.gz: 570bd144778988ec838d5cca9df00ceb69c68edc
3
+ metadata.gz: 331aa60059103991dd91737e6cc4a9f2fa4142dc
4
+ data.tar.gz: 9c63593f5d12959e5b70e6973336360ad32887c8
5
5
  SHA512:
6
- metadata.gz: 9d4a4d4ebf6a7b1663da08d7f4a022093d657ad07cfea23f592b0929b28c9f72d68d587092c8f8b3ae5d5f496b41ed86ac22c7b9f8012757dc475190e141da39
7
- data.tar.gz: 367718c024b1ff284ddbaf6f5b0bd8974b57e8e4ada91b2d917ae5b8097471feaf782facb8aaf66cb78e32299e19d664b929209a877b3fa41287cf0e9e88d554
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))
@@ -5,5 +5,5 @@ dependencies {
5
5
 
6
6
  testCompile 'org.embulk:embulk-standards:0.8.22'
7
7
  testCompile project(':embulk-output-jdbc').sourceSets.test.output
8
- testCompile files('driver/db2jcc4.jar')
8
+ testCompile files('test_jdbc_driver/db2jcc4.jar')
9
9
  }
@@ -65,7 +65,7 @@ public class DB2OutputPlugin
65
65
  DB2PluginTask db2Task = (DB2PluginTask) task;
66
66
 
67
67
  if (db2Task.getDriverPath().isPresent()) {
68
- loadDriverJar(db2Task.getDriverPath().get());
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
- public void dropTableIfExists(TableIdentifier table) throws SQLException
40
+ protected boolean supportsTableIfExistsClause()
43
41
  {
44
- if (tableExists(table)) {
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/driver' directory in order to test.");
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.12
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-24 00:00:00.000000000 Z
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.12.jar
23
- - classpath/embulk-output-jdbc-0.7.12.jar
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