embulk-output-oracle 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1d28f36dd963700598d5e2e9db74b33e3228c59
4
- data.tar.gz: ca497010b7149986e179b302532d14cf08fcaf53
3
+ metadata.gz: 4c80319aa49fcd2a1887d1e8ceb3d6bce058f5a3
4
+ data.tar.gz: a8c5d2cbe6cb8af65be5d0a33834f1807cd241db
5
5
  SHA512:
6
- metadata.gz: 4b39a9146122ea3b3b178efe4a22a576b9afdeab1d03f42c273372ffb4181763fbce6b5a6689eef3058064bafd2422980338f9b284dd6415fe48bb7ec6c5bb45
7
- data.tar.gz: 5a381e830a0acd21459e4086de1b876ea06c07331a6a6821bcc1ed0d11c518db92499c3389b39b15e4ff054b1664c66724694c822e9dde0ecc1d8068b5660629
6
+ metadata.gz: 93e147585a62ba7851725283165fb96eb3be74913b585e8245c629d3247b6fb34d9cc41b41ece68ab7089ec3e3de728943341cc419b288ceb56ec6116d8559e1
7
+ data.tar.gz: db9c730a1f0e68b4a911ffc1a185e36e761b71e7e46f99ba5566c9d54e28ab9d0a46267ebcc6b1a3abf414922a70baf8e2a14a7d4ca6b9c2941e4f557de20320
data/README.md CHANGED
@@ -20,6 +20,8 @@ Oracle output plugin for Embulk loads records to Oracle.
20
20
  - **temp_schema**: schema name for intermediate tables. by default, intermediate tables will be created in the same schema as destination table. replace mode doesn't support temp_schema. (string, optional)
21
21
  - **url**: URL of the JDBC connection (string, optional)
22
22
  - **table**: destination table name (string, required)
23
+ - **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>`.
24
+ - **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>`.
23
25
  - **options**: extra connection properties (hash, default: {})
24
26
  - **retry_limit** max retry count for database operations (integer, default: 12)
25
27
  - **retry_wait** initial retry wait time in milliseconds (integer, default: 1000 (1 second))
data/build.gradle CHANGED
@@ -3,5 +3,5 @@ dependencies {
3
3
 
4
4
  testCompile 'org.embulk:embulk-standards:0.8.22'
5
5
  testCompile project(':embulk-output-jdbc').sourceSets.test.output
6
- testCompile files('driver/ojdbc7.jar')
6
+ testCompile files('test_jdbc_driver/ojdbc7.jar')
7
7
  }
@@ -83,7 +83,7 @@ public class OracleOutputPlugin
83
83
  OraclePluginTask oracleTask = (OraclePluginTask) task;
84
84
 
85
85
  if (oracleTask.getDriverPath().isPresent()) {
86
- loadDriverJar(oracleTask.getDriverPath().get());
86
+ addDriverJarToClasspath(oracleTask.getDriverPath().get());
87
87
  }
88
88
 
89
89
  String url;
@@ -64,26 +64,9 @@ public class OracleOutputConnection
64
64
  }
65
65
 
66
66
  @Override
67
- public void dropTableIfExists(TableIdentifier table) throws SQLException
67
+ protected boolean supportsTableIfExistsClause()
68
68
  {
69
- if (tableExists(table)) {
70
- dropTable(table);
71
- }
72
- }
73
-
74
- @Override
75
- protected void dropTableIfExists(Statement stmt, TableIdentifier table) throws SQLException {
76
- if (tableExists(table)) {
77
- dropTable(stmt, table);
78
- }
79
- }
80
-
81
- @Override
82
- public void createTableIfNotExists(TableIdentifier table, JdbcSchema schema) throws SQLException
83
- {
84
- if (!tableExists(table)) {
85
- createTable(table, schema);
86
- }
69
+ return false;
87
70
  }
88
71
 
89
72
  private static String getSchema(Connection connection) throws SQLException
@@ -1,9 +1,6 @@
1
1
  package org.embulk.output.oracle.oci;
2
2
 
3
3
  import java.io.File;
4
- import java.net.MalformedURLException;
5
- import java.net.URISyntaxException;
6
- import java.net.URL;
7
4
  import java.nio.ByteBuffer;
8
5
  import java.nio.charset.Charset;
9
6
  import java.sql.SQLException;
@@ -15,14 +12,13 @@ import jnr.ffi.Runtime;
15
12
  import jnr.ffi.provider.jffi.ArrayMemoryIO;
16
13
  import jnr.ffi.provider.jffi.ByteBufferMemoryIO;
17
14
 
15
+ import org.embulk.output.jdbc.AbstractJdbcOutputPlugin;
18
16
  import org.embulk.spi.Exec;
19
17
  import org.slf4j.Logger;
20
18
 
21
19
 
22
20
  public class OCIWrapper
23
21
  {
24
- private static final String PLUGIN_NAME = "embulk-output-oracle";
25
-
26
22
  private static OCI oci;
27
23
  private static BulkOCI bulkOci;
28
24
 
@@ -88,7 +84,7 @@ public class OCIWrapper
88
84
 
89
85
  Platform platform = Platform.getNativePlatform();
90
86
 
91
- File folder = getPluginRoot();
87
+ File folder = AbstractJdbcOutputPlugin.findPluginRoot(getClass());
92
88
  folder = new File(new File(new File(new File(folder ,"lib"), "embulk"), "native"), platform.getName());
93
89
 
94
90
  File file = new File(folder, System.mapLibraryName(libraryName));
@@ -101,30 +97,6 @@ public class OCIWrapper
101
97
  return LibraryLoader.create(BulkOCI.class).search(folder.getAbsolutePath()).failImmediately().load(libraryName);
102
98
  }
103
99
 
104
- private File getPluginRoot()
105
- {
106
- try {
107
- URL url = getClass().getResource("/" + getClass().getName().replace('.', '/') + ".class");
108
- if (url.toString().startsWith("jar:")) {
109
- url = new URL(url.toString().replaceAll("^jar:", "").replaceAll("![^!]*$", ""));
110
- }
111
-
112
- File folder = new File(url.toURI()).getParentFile();
113
- for (;; folder = folder.getParentFile()) {
114
- if (folder == null) {
115
- String message = String.format("OCI : %s folder not found.", PLUGIN_NAME);
116
- throw new RuntimeException(message);
117
- }
118
-
119
- if (folder.getName().startsWith(PLUGIN_NAME)) {
120
- return folder;
121
- }
122
- }
123
- } catch (MalformedURLException | URISyntaxException e) {
124
- throw new RuntimeException(e);
125
- }
126
- }
127
-
128
100
  public void open(String dbName, String userName, String password) throws SQLException
129
101
  {
130
102
  Pointer envHandlePointer = createPointerPointer();
@@ -27,7 +27,7 @@ public class OracleTests
27
27
  try {
28
28
  Class.forName("oracle.jdbc.OracleDriver");
29
29
  } catch (ClassNotFoundException e) {
30
- throw new RuntimeException("You should put 'ojdbc7.jar' in 'embulk-output-oracle/driver' directory in order to test.");
30
+ throw new RuntimeException("You should put 'ojdbc7.jar' in 'embulk-output-oracle/test_jdbc_driver' directory in order to test.");
31
31
  }
32
32
 
33
33
  Path sqlFile = embulk.createTempFile("sql");
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-oracle
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-jdbc-0.7.12.jar
23
- - classpath/embulk-output-oracle-0.7.12.jar
22
+ - classpath/embulk-output-jdbc-0.7.13.jar
23
+ - classpath/embulk-output-oracle-0.7.13.jar
24
24
  - lib/embulk/native/x86_64-linux/libembulk-output-oracle-oci.so
25
25
  - lib/embulk/native/x86_64-windows/embulk-output-oracle-oci.dll
26
26
  - lib/embulk/output/oracle.rb