org.hibernate.mapping.ClickHouseArrayMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate6-clickhouse-dialect Show documentation
Show all versions of hibernate6-clickhouse-dialect Show documentation
Hibernate 6 compliant clickhouse dialect
The newest version!
package org.hibernate.mapping;
import java.util.*;
public class ClickHouseArrayMapper {
public static String[] getStringArray(Object[] objects) {
String [] strings = new String[objects.length];
for (int i =0; i getOrderedStringSet(Object[] result) {
LinkedList strings = new LinkedList<>();
if (result == null) {
return new LinkedList<>();
}
int length = result.length;
StringBuilder sb = new StringBuilder();
for (int i = 1; i < length; i++) {
char letter = (char) ((byte) result[i]);
if (letter == ',' || letter == ']') {
strings.add(sb.toString());
sb = new StringBuilder();
} else {
sb.append(letter);
}
}
return strings;
}
public static LinkedList getOrderedIntegerSet(Object[] result) {
LinkedList strings = new LinkedList<>();
if (result == null) {
return new LinkedList<>();
}
int length = result.length;
StringBuilder sb = new StringBuilder();
for (int i = 1; i < length; i++) {
char letter = (char) ((byte) result[i]);
if (letter == ',' || letter == ']') {
strings.add(Integer.valueOf(sb.toString()));
sb = new StringBuilder();
} else {
sb.append(letter);
}
}
return strings;
}
}