|
@@ -3,10 +3,13 @@
|
|
*/
|
|
*/
|
|
package org.dbsyncer.connector.oracle.schema.support;
|
|
package org.dbsyncer.connector.oracle.schema.support;
|
|
|
|
|
|
|
|
+import oracle.sql.BLOB;
|
|
import org.dbsyncer.common.util.StringUtil;
|
|
import org.dbsyncer.common.util.StringUtil;
|
|
|
|
+import org.dbsyncer.connector.oracle.OracleException;
|
|
import org.dbsyncer.sdk.model.Field;
|
|
import org.dbsyncer.sdk.model.Field;
|
|
import org.dbsyncer.sdk.schema.support.BytesType;
|
|
import org.dbsyncer.sdk.schema.support.BytesType;
|
|
|
|
|
|
|
|
+import java.sql.SQLException;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -40,8 +43,21 @@ public final class OracleBytesType extends BytesType {
|
|
return Arrays.stream(TypeEnum.values()).map(TypeEnum::getValue).collect(Collectors.toSet());
|
|
return Arrays.stream(TypeEnum.values()).map(TypeEnum::getValue).collect(Collectors.toSet());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ protected byte[] getDefaultMergedVal() {
|
|
|
|
+ return new byte[0];
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected byte[] merge(Object val, Field field) {
|
|
protected byte[] merge(Object val, Field field) {
|
|
|
|
+ if (val instanceof BLOB) {
|
|
|
|
+ try {
|
|
|
|
+ BLOB blob = (BLOB) val;
|
|
|
|
+ return blob.getBytes(1, (int) blob.length());
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
+ throw new OracleException(e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return throwUnsupportedException(val, field);
|
|
return throwUnsupportedException(val, field);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -55,6 +71,7 @@ public final class OracleBytesType extends BytesType {
|
|
if ("EMPTY_BLOB()".equals(s)) {
|
|
if ("EMPTY_BLOB()".equals(s)) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
+ return s.getBytes();
|
|
}
|
|
}
|
|
return super.convert(val, field);
|
|
return super.convert(val, field);
|
|
}
|
|
}
|