tech.ydb.jdbc.common.FixedResultSetFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ydb-jdbc-driver Show documentation
Show all versions of ydb-jdbc-driver Show documentation
JDBC Driver over YDB Java SDK
package tech.ydb.jdbc.common;
import java.nio.charset.Charset;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import tech.ydb.table.result.ResultSetReader;
import tech.ydb.table.result.ValueReader;
import tech.ydb.table.values.DecimalValue;
import tech.ydb.table.values.PrimitiveType;
import tech.ydb.table.values.PrimitiveValue;
import tech.ydb.table.values.Type;
import tech.ydb.table.values.Value;
/**
*
* @author Aleksandr Gorshenin
*/
public class FixedResultSetFactory {
private final List columns;
private final Map columnIndexes;
private FixedResultSetFactory(List columns) {
this.columns = columns;
this.columnIndexes = new HashMap<>();
for (int idx = 0; idx < columns.size(); idx += 1) {
columnIndexes.put(columns.get(idx).name, idx);
}
}
public interface ResultSetBuilder {
public interface RowBuilder {
RowBuilder withTextValue(String name, String value);
RowBuilder withIntValue(String name, int value);
RowBuilder withShortValue(String name, short value);
RowBuilder withLongValue(String name, long value);
RowBuilder withBoolValue(String name, boolean value);
ResultSetBuilder build();
}
RowBuilder newRow();
ResultSetReader build();
}
public ResultSetBuilder createResultSet() {
return new ResultSetBuilderImpl();
}
private class ResultSetBuilderImpl implements ResultSetBuilder {
private final List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy