Skip to content

Commit

Permalink
0002401: Support clobs in the oracle bulk loader
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Oct 5, 2015
1 parent 46a1f51 commit 970e6bf
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -92,7 +92,7 @@ public void write(CsvData data) {
statistics.get(batch).increment(DataWriterStatisticConstants.LINENUMBER);
if (filterBefore(data)) {
Object[] rowData = platform.getObjectValues(batch.getBinaryEncoding(), getRowData(data, CsvData.ROW_DATA),
targetTable.getColumns());
targetTable.getColumns(), false, writerSettings.isFitToColumn());
for (int i = 0; i < rowData.length; i++) {

List<Object> columnList = null;
Expand Down Expand Up @@ -216,8 +216,13 @@ protected void buildBulkDataType(int typeCode) {

protected String getMappedType(int typeCode) {
switch (typeCode) {
case Types.CLOB:
case Types.CHAR:
case Types.NCHAR:
case Types.VARCHAR:
case Types.NVARCHAR:
case Types.LONGVARCHAR:
case Types.LONGNVARCHAR:
return "varchar(4000)";
case Types.DATE:
case Types.TIME:
Expand All @@ -244,8 +249,13 @@ protected String getMappedType(int typeCode) {

protected String getTypeName(int typeCode) {
switch (typeCode) {
case Types.CLOB:
case Types.CHAR:
case Types.NCHAR:
case Types.VARCHAR:
case Types.NVARCHAR:
case Types.LONGVARCHAR:
case Types.LONGNVARCHAR:
return String.format("%s_%s_t", procedurePrefix, "varchar").toUpperCase();
case Types.DATE:
case Types.TIME:
Expand Down Expand Up @@ -274,7 +284,7 @@ protected List<Column> getBulkLoadableColumns(Table table) {
// TODO support BLOB and CLOBs in bulk load. For now, remove them
while (iterator.hasNext()) {
Column column = (Column) iterator.next();
if (column.getMappedTypeCode() == Types.CLOB || column.getMappedTypeCode() == Types.BLOB
if (column.getMappedTypeCode() == Types.BLOB
|| column.getMappedTypeCode() == Types.VARBINARY) {
iterator.remove();
}
Expand Down

0 comments on commit 970e6bf

Please sign in to comment.