embulk-output-oracle 0.4.0 → 0.4.1

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +160 -160
  3. data/build.gradle +6 -6
  4. data/classpath/{embulk-output-jdbc-0.4.0.jar → embulk-output-jdbc-0.4.1.jar} +0 -0
  5. data/classpath/{embulk-output-oracle-0.4.0.jar → embulk-output-oracle-0.4.1.jar} +0 -0
  6. data/lib/embulk/output/oracle.rb +3 -3
  7. data/src/main/cpp/common/dir-path-load.cpp +424 -424
  8. data/src/main/cpp/common/dir-path-load.h +36 -36
  9. data/src/main/cpp/common/embulk-output-oracle.cpp +196 -196
  10. data/src/main/cpp/common/org_embulk_output_oracle_oci_OCI.h +77 -77
  11. data/src/main/cpp/linux/build.sh +21 -21
  12. data/src/main/cpp/win/build.bat +31 -31
  13. data/src/main/cpp/win/dllmain.cpp +25 -25
  14. data/src/main/cpp/win/embulk-output-oracle.sln +39 -39
  15. data/src/main/cpp/win/embulk-output-oracle.vcxproj +175 -175
  16. data/src/main/java/org/embulk/output/OracleOutputPlugin.java +153 -153
  17. data/src/main/java/org/embulk/output/oracle/DirectBatchInsert.java +290 -290
  18. data/src/main/java/org/embulk/output/oracle/InsertMethod.java +8 -8
  19. data/src/main/java/org/embulk/output/oracle/OracleCharset.java +32 -32
  20. data/src/main/java/org/embulk/output/oracle/OracleOutputConnection.java +165 -165
  21. data/src/main/java/org/embulk/output/oracle/OracleOutputConnector.java +49 -49
  22. data/src/main/java/org/embulk/output/oracle/TimestampFormat.java +37 -37
  23. data/src/main/java/org/embulk/output/oracle/oci/ColumnDefinition.java +26 -26
  24. data/src/main/java/org/embulk/output/oracle/oci/OCI.java +139 -139
  25. data/src/main/java/org/embulk/output/oracle/oci/OCIManager.java +64 -64
  26. data/src/main/java/org/embulk/output/oracle/oci/OCIWrapper.java +96 -96
  27. data/src/main/java/org/embulk/output/oracle/oci/RowBuffer.java +105 -105
  28. data/src/main/java/org/embulk/output/oracle/oci/TableDefinition.java +24 -24
  29. data/src/test/cpp/common/embulk-output-oracle-test.cpp +69 -69
  30. data/src/test/cpp/linux/build.sh +19 -19
  31. data/src/test/cpp/win/build.bat +28 -28
  32. data/src/test/cpp/win/embulk-output-oracle-test.vcxproj +154 -154
  33. data/src/test/java/org/embulk/input/filesplit/LocalFileSplitInputPlugin.java +187 -187
  34. data/src/test/java/org/embulk/input/filesplit/PartialFile.java +49 -49
  35. data/src/test/java/org/embulk/input/filesplit/PartialFileInputStream.java +154 -154
  36. data/src/test/java/org/embulk/output/oracle/ChildFirstClassLoader.java +42 -42
  37. data/src/test/java/org/embulk/output/oracle/EmbulkPluginTester.java +124 -120
  38. data/src/test/java/org/embulk/output/oracle/EmptyConfigSource.java +105 -100
  39. data/src/test/java/org/embulk/output/oracle/OracleOutputPluginTest.java +38 -14
  40. data/src/test/java/org/embulk/output/oracle/OracleOutputPluginTestImpl.java +540 -484
  41. data/src/test/java/org/embulk/output/oracle/TimestampFormatTest.java +57 -57
  42. data/src/test/resources/data/test1/test1.csv +3 -3
  43. data/src/test/resources/yml/test-insert-direct-direct-method.yml +26 -0
  44. data/src/test/resources/yml/test-insert-direct-empty.yml +25 -0
  45. data/src/test/resources/yml/{test-insert-oci-split.yml → test-insert-direct-oci-method-split.yml} +28 -28
  46. data/src/test/resources/yml/{test-insert-oci.yml → test-insert-direct-oci-method.yml} +28 -28
  47. data/src/test/resources/yml/test-insert-direct.yml +25 -26
  48. data/src/test/resources/yml/test-insert-empty.yml +27 -0
  49. data/src/test/resources/yml/test-insert.yml +27 -25
  50. data/src/test/resources/yml/test-replace-empty.yml +31 -0
  51. data/src/test/resources/yml/test-replace-long-name-multibyte.yml +31 -31
  52. data/src/test/resources/yml/test-replace-long-name.yml +31 -31
  53. data/src/test/resources/yml/test-replace.yml +31 -31
  54. data/src/test/resources/yml/test-string-timestamp.yml +28 -28
  55. data/src/test/resources/yml/test-url.yml +24 -24
  56. metadata +10 -6
@@ -1,57 +1,57 @@
1
- package org.embulk.output.oracle;
2
-
3
- import java.sql.Timestamp;
4
- import java.text.ParseException;
5
- import java.text.SimpleDateFormat;
6
- import java.util.Date;
7
-
8
- import org.junit.Test;
9
- import static org.junit.Assert.assertEquals;
10
-
11
- public class TimestampFormatTest {
12
-
13
- @Test
14
- public void test() throws ParseException
15
- {
16
- Date date = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse("2015/03/04 17:08:09");
17
- Timestamp t = new Timestamp(date.getTime());
18
-
19
- {
20
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 9);
21
- assertEquals("2015-03-04 17:08:09.000000000", format.format(t));
22
- }
23
- {
24
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 0);
25
- assertEquals("2015-03-04 17:08:09", format.format(t));
26
- }
27
- {
28
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 1);
29
- assertEquals("2015-03-04 17:08:09.0", format.format(t));
30
- }
31
-
32
- t.setNanos(1234567);
33
- {
34
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 9);
35
- assertEquals("2015-03-04 17:08:09.001234567", format.format(t));
36
- }
37
- {
38
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 2);
39
- assertEquals("2015-03-04 17:08:09.00", format.format(t));
40
- }
41
- {
42
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 3);
43
- assertEquals("2015-03-04 17:08:09.001", format.format(t));
44
- }
45
-
46
- t.setNanos(123456789);
47
- {
48
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 9);
49
- assertEquals("2015-03-04 17:08:09.123456789", format.format(t));
50
- }
51
- {
52
- TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 1);
53
- assertEquals("2015-03-04 17:08:09.1", format.format(t));
54
- }
55
- }
56
-
57
- }
1
+ package org.embulk.output.oracle;
2
+
3
+ import java.sql.Timestamp;
4
+ import java.text.ParseException;
5
+ import java.text.SimpleDateFormat;
6
+ import java.util.Date;
7
+
8
+ import org.junit.Test;
9
+ import static org.junit.Assert.assertEquals;
10
+
11
+ public class TimestampFormatTest {
12
+
13
+ @Test
14
+ public void test() throws ParseException
15
+ {
16
+ Date date = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse("2015/03/04 17:08:09");
17
+ Timestamp t = new Timestamp(date.getTime());
18
+
19
+ {
20
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 9);
21
+ assertEquals("2015-03-04 17:08:09.000000000", format.format(t));
22
+ }
23
+ {
24
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 0);
25
+ assertEquals("2015-03-04 17:08:09", format.format(t));
26
+ }
27
+ {
28
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 1);
29
+ assertEquals("2015-03-04 17:08:09.0", format.format(t));
30
+ }
31
+
32
+ t.setNanos(1234567);
33
+ {
34
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 9);
35
+ assertEquals("2015-03-04 17:08:09.001234567", format.format(t));
36
+ }
37
+ {
38
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 2);
39
+ assertEquals("2015-03-04 17:08:09.00", format.format(t));
40
+ }
41
+ {
42
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 3);
43
+ assertEquals("2015-03-04 17:08:09.001", format.format(t));
44
+ }
45
+
46
+ t.setNanos(123456789);
47
+ {
48
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 9);
49
+ assertEquals("2015-03-04 17:08:09.123456789", format.format(t));
50
+ }
51
+ {
52
+ TimestampFormat format = new TimestampFormat("yyyy-MM-dd HH:mm:ss", 1);
53
+ assertEquals("2015-03-04 17:08:09.1", format.format(t));
54
+ }
55
+ }
56
+
57
+ }
@@ -1,3 +1,3 @@
1
- A001,ABCDE,0,123.45,2015/03/05,2015/03/05 12:34:56
2
- A002,あいうえお,-9999,-99999999.99,2015/03/06,2015/03/06 23:59:59
3
- A003,,,,,
1
+ A001,ABCDE,0,123.45,2015/03/05,2015/03/05 12:34:56
2
+ A002,あいうえお,-9999,-99999999.99,2015/03/06,2015/03/06 23:59:59
3
+ A003,,,,,
@@ -0,0 +1,26 @@
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test1/test1.csv'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: insert_direct
25
+ insert_method: direct
26
+ #driver_path: driver/ojdbc7.jar
@@ -0,0 +1,25 @@
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test2/'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: insert_direct
25
+ #driver_path: driver/ojdbc7.jar
@@ -1,28 +1,28 @@
1
- in:
2
- type: filesplit
3
- path: '/data/test1/test1.csv'
4
- parser:
5
- charset: UTF-8
6
- newline: CRLF
7
- type: csv
8
- delimiter: ','
9
- quote: ''
10
- columns:
11
- - {name: ID, type: string}
12
- - {name: VARCHAR2_ITEM, type: string}
13
- - {name: INTEGER_ITEM, type: long}
14
- - {name: NUMBER_ITEM, type: string}
15
- - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
- - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
- out:
18
- type: oracle
19
- host: localhost
20
- database: TESTDB
21
- user: TEST_USER
22
- password: test_pw
23
- table: TEST1
24
- mode: insert_direct
25
- insert_method: oci
26
- column_options:
27
- INTEGER_ITEM: {value_type: pass}
28
- #driver_path: driver/ojdbc7.jar
1
+ in:
2
+ type: filesplit
3
+ path: '/data/test1/test1.csv'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: insert_direct
25
+ insert_method: oci
26
+ column_options:
27
+ INTEGER_ITEM: {value_type: pass}
28
+ #driver_path: driver/ojdbc7.jar
@@ -1,28 +1,28 @@
1
- in:
2
- type: file
3
- path_prefix: '/data/test1/test1.csv'
4
- parser:
5
- charset: UTF-8
6
- newline: CRLF
7
- type: csv
8
- delimiter: ','
9
- quote: ''
10
- columns:
11
- - {name: ID, type: string}
12
- - {name: VARCHAR2_ITEM, type: string}
13
- - {name: INTEGER_ITEM, type: long}
14
- - {name: NUMBER_ITEM, type: string}
15
- - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
- - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
- out:
18
- type: oracle
19
- host: localhost
20
- database: TESTDB
21
- user: TEST_USER
22
- password: test_pw
23
- table: TEST1
24
- mode: insert_direct
25
- insert_method: oci
26
- column_options:
27
- INTEGER_ITEM: {value_type: pass}
28
- #driver_path: driver/ojdbc7.jar
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test1/test1.csv'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: insert_direct
25
+ insert_method: oci
26
+ column_options:
27
+ INTEGER_ITEM: {value_type: pass}
28
+ #driver_path: driver/ojdbc7.jar
@@ -1,26 +1,25 @@
1
- in:
2
- type: file
3
- path_prefix: '/data/test1/test1.csv'
4
- parser:
5
- charset: UTF-8
6
- newline: CRLF
7
- type: csv
8
- delimiter: ','
9
- quote: ''
10
- columns:
11
- - {name: ID, type: string}
12
- - {name: VARCHAR2_ITEM, type: string}
13
- - {name: INTEGER_ITEM, type: long}
14
- - {name: NUMBER_ITEM, type: string}
15
- - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
- - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
- out:
18
- type: oracle
19
- host: localhost
20
- database: TESTDB
21
- user: TEST_USER
22
- password: test_pw
23
- table: TEST1
24
- mode: insert_direct
25
- insert_method: direct
26
- #driver_path: driver/ojdbc7.jar
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test1/test1.csv'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: insert_direct
25
+ #driver_path: driver/ojdbc7.jar
@@ -0,0 +1,27 @@
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test2/'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: insert
25
+ #driver_path: driver/ojdbc7.jar
26
+ column_options:
27
+ VARCHAR2_ITEM: {type: VARCHAR2(40)}
@@ -1,25 +1,27 @@
1
- in:
2
- type: file
3
- path_prefix: '/data/test1/test1.csv'
4
- parser:
5
- charset: UTF-8
6
- newline: CRLF
7
- type: csv
8
- delimiter: ','
9
- quote: ''
10
- columns:
11
- - {name: ID, type: string}
12
- - {name: VARCHAR2_ITEM, type: string}
13
- - {name: INTEGER_ITEM, type: long}
14
- - {name: NUMBER_ITEM, type: string}
15
- - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
- - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
- out:
18
- type: oracle
19
- host: localhost
20
- database: TESTDB
21
- user: TEST_USER
22
- password: test_pw
23
- table: TEST1
24
- mode: insert_direct
25
- #driver_path: driver/ojdbc7.jar
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test1/test1.csv'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: insert
25
+ #driver_path: driver/ojdbc7.jar
26
+ column_options:
27
+ VARCHAR2_ITEM: {type: VARCHAR2(40)}
@@ -0,0 +1,31 @@
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test2/'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: replace
25
+ column_options:
26
+ VARCHAR2_ITEM: {type: 'VARCHAR2(40)'}
27
+ INTEGER_ITEM: {type: 'NUMBER(4,0)'}
28
+ NUMBER_ITEM: {type: 'NUMBER(10,2)'}
29
+ DATE_ITEM: {type: 'DATE'}
30
+ TIMESTAMP_ITEM: {type: 'TIMESTAMP'}
31
+ #driver_path: driver/ojdbc7.jar