embulk-input-oracle 0.8.5 → 0.8.6

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: faa381d190b65904b3393967e047467972a826f4
4
- data.tar.gz: f77b70585994e6b192c0ab803def3a5eba4a7029
3
+ metadata.gz: 6b2a3b361655d84baa4f070934441854322eae73
4
+ data.tar.gz: b32e4d1d7f217981af117e5139fcbc83a374a7e7
5
5
  SHA512:
6
- metadata.gz: d6e9f34bf9e431ad011f2e474c466f2add3ad4044c2c9d7e99cd11baa3f130b9846326ecf59907cbf3e021be83b13a5828918c99ac8671562fe865d42c12604b
7
- data.tar.gz: 859e82a91aaee603bf109685c9e5d5abc92568a05ff2a5cae89bfea950ae6b673ee4140990841015b1223d4ac5635f63dea8e27affbdebc55f2e5ee60a77964a
6
+ metadata.gz: 30911500bde0d44e415ab5c483875cc23f034d0893bc8cfbffd91266c59df5e01b66a55fbb48d362301bc6c281b0fd4b69c092e51c68fa9d99ee9f5260ca91e4
7
+ data.tar.gz: 7a37fd58d8555b1175fddd1173b621acb6c8e89a977812cfd960d9e551d7714902324a5810c991d9bcf3c015e7e49cc391cbfa8c8c2b2142016fd33fcdb919f0
data/README.md CHANGED
@@ -67,7 +67,7 @@ At the next execution, when `last_record: ` is also set, this plugin generates a
67
67
  SELECT * FROM (
68
68
  ...original query is here...
69
69
  )
70
- WHERE created_at > '2017-01-01 00:32:12' OR (created_at = '2017-01-01 00:32:12' AND id > 5291)
70
+ WHERE updated_at > '2017-01-01 00:32:12' OR (updated_at = '2017-01-01 00:32:12' AND id > 5291)
71
71
  ORDER BY updated_at, id
72
72
  ```
73
73
 
@@ -1,7 +1,9 @@
1
1
  package org.embulk.input.oracle;
2
2
 
3
3
  import java.sql.Connection;
4
+ import java.sql.ResultSet;
4
5
  import java.sql.SQLException;
6
+ import java.sql.Statement;
5
7
 
6
8
  import org.embulk.input.jdbc.JdbcInputConnection;
7
9
 
@@ -9,7 +11,7 @@ public class OracleInputConnection extends JdbcInputConnection {
9
11
 
10
12
  public OracleInputConnection(Connection connection, String schemaName) throws SQLException
11
13
  {
12
- super(connection, schemaName);
14
+ super(connection, schemaName == null ? getSchema(connection) : schemaName);
13
15
  }
14
16
 
15
17
  @Override
@@ -18,4 +20,18 @@ public class OracleInputConnection extends JdbcInputConnection {
18
20
  connection.setSchema(schema);
19
21
  }
20
22
 
23
+ private static String getSchema(Connection connection) throws SQLException
24
+ {
25
+ // Because old Oracle JDBC drivers don't support Connection#getSchema method.
26
+ String sql = "SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL";
27
+ try (Statement statement = connection.createStatement()) {
28
+ try (ResultSet resultSet = statement.executeQuery(sql)) {
29
+ if (resultSet.next()) {
30
+ return resultSet.getString(1);
31
+ }
32
+ throw new SQLException(String.format("Cannot get schema becase \"%s\" didn't return any value.", sql));
33
+ }
34
+ }
35
+ }
36
+
21
37
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-oracle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
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-07-31 00:00:00.000000000 Z
11
+ date: 2017-11-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from 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-input-jdbc-0.8.5.jar
23
- - classpath/embulk-input-oracle-0.8.5.jar
22
+ - classpath/embulk-input-jdbc-0.8.6.jar
23
+ - classpath/embulk-input-oracle-0.8.6.jar
24
24
  - lib/embulk/input/oracle.rb
25
25
  - src/main/java/org/embulk/input/OracleInputPlugin.java
26
26
  - src/main/java/org/embulk/input/oracle/OracleInputConnection.java
Binary file