added compare method

This commit is contained in:
Wisser
2018-11-08 07:14:03 +01:00
parent d82cbe61d6
commit 85559cdea7
2 changed files with 19 additions and 2 deletions
@@ -201,7 +201,7 @@ public class CellContentConverter {
POSTGRES_EXTENSIONS.addAll(Arrays.asList("hstore", "ghstore", "json", "jsonb", "_hstore", "_json", "_jsonb", "_ghstore"));
}
public static class PObjectWrapper {
public static class PObjectWrapper implements Comparable<PObjectWrapper> {
private final String value;
private final String type;
public PObjectWrapper(String value, String type) {
@@ -247,9 +247,16 @@ public class CellContentConverter {
return false;
return true;
}
@Override
public int compareTo(PObjectWrapper o) {
if (o instanceof PObjectWrapper) {
return toString().compareTo(o.toString());
}
return 0;
}
}
public static class NCharWrapper {
public static class NCharWrapper implements Comparable<NCharWrapper> {
private final String value;
public NCharWrapper(String value) {
this.value = value;
@@ -281,6 +288,13 @@ public class CellContentConverter {
public String toString() {
return value;
}
@Override
public int compareTo(NCharWrapper o) {
if (o instanceof NCharWrapper) {
return toString().compareTo(o.toString());
}
return 0;
}
}
/**
@@ -479,6 +479,9 @@ public class SqlUtil {
String tReplacement = String.format(tSplitted[1], session.dbms.getIncrementalInsertIncrementSize());
Pattern pattern = Pattern.compile(tPattern, Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
String incrementalSelect = pattern.matcher(select).replaceFirst(tReplacement);
if (!incrementalSelect.equals(select)) {
throw new RuntimeException("Pattern \"" + tPattern + "\" dont match \"" + select + "\"");
}
return incrementalSelect;
}