embulk-output-oracle 0.2.3 → 0.2.4

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +110 -110
  3. data/build.gradle +6 -6
  4. data/classpath/{embulk-output-jdbc-0.2.3.jar → embulk-output-jdbc-0.2.4.jar} +0 -0
  5. data/classpath/{embulk-output-oracle-0.2.3.jar → embulk-output-oracle-0.2.4.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/oracle/DirectBatchInsert.java +289 -289
  17. data/src/main/java/org/embulk/output/oracle/InsertMethod.java +8 -8
  18. data/src/main/java/org/embulk/output/oracle/OracleCharset.java +19 -19
  19. data/src/main/java/org/embulk/output/oracle/OracleOutputConnection.java +134 -134
  20. data/src/main/java/org/embulk/output/oracle/OracleOutputConnector.java +49 -49
  21. data/src/main/java/org/embulk/output/oracle/TimestampFormat.java +37 -37
  22. data/src/main/java/org/embulk/output/oracle/oci/ColumnDefinition.java +26 -26
  23. data/src/main/java/org/embulk/output/oracle/oci/OCI.java +139 -139
  24. data/src/main/java/org/embulk/output/oracle/oci/OCIManager.java +64 -64
  25. data/src/main/java/org/embulk/output/oracle/oci/OCIWrapper.java +96 -96
  26. data/src/main/java/org/embulk/output/oracle/oci/RowBuffer.java +99 -99
  27. data/src/main/java/org/embulk/output/oracle/oci/TableDefinition.java +24 -24
  28. data/src/main/java/org/embulk/output/oracle/setter/OracleColumnSetterFactory.java +31 -31
  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 +120 -120
  38. data/src/test/java/org/embulk/output/oracle/EmptyConfigSource.java +100 -100
  39. data/src/test/java/org/embulk/output/oracle/OracleOutputPluginTest.java +161 -161
  40. data/src/test/java/org/embulk/output/oracle/OracleOutputPluginTestImpl.java +413 -413
  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.yml +26 -26
  44. data/src/test/resources/yml/test-insert-oci-split.yml +26 -26
  45. data/src/test/resources/yml/test-insert-oci.yml +26 -26
  46. data/src/test/resources/yml/test-insert.yml +25 -25
  47. data/src/test/resources/yml/test-replace-long-name.yml +25 -25
  48. data/src/test/resources/yml/test-replace.yml +25 -25
  49. data/src/test/resources/yml/test-url.yml +24 -24
  50. metadata +4 -4
@@ -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,,,,,
@@ -1,26 +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
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
25
+ insert_method: direct
26
+ #driver_path: driver/ojdbc7.jar
@@ -1,26 +1,26 @@
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
25
- insert_method: oci
26
- #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
25
+ insert_method: oci
26
+ #driver_path: driver/ojdbc7.jar
@@ -1,26 +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
25
- insert_method: oci
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
25
+ insert_method: oci
26
+ #driver_path: driver/ojdbc7.jar
@@ -1,25 +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
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
@@ -1,25 +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: TEST12345678901234567890123456
24
- mode: replace
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: TEST12345678901234567890123456
24
+ mode: replace
25
+ #driver_path: driver/ojdbc7.jar
@@ -1,25 +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: replace
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: replace
25
+ #driver_path: driver/ojdbc7.jar
@@ -1,24 +1,24 @@
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
- user: TEST_USER
20
- password: test_pw
21
- table: TEST1
22
- mode: insert
23
- #driver_path: driver/ojdbc7.jar
24
- url: jdbc:oracle:thin:@localhost:1521:TESTDB
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
+ user: TEST_USER
20
+ password: test_pw
21
+ table: TEST1
22
+ mode: insert
23
+ #driver_path: driver/ojdbc7.jar
24
+ url: jdbc:oracle:thin:@localhost:1521:TESTDB