tech.ydb.jdbc.query.params.UInt64JdbcPrm 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.query.params;
import java.sql.SQLException;
import tech.ydb.jdbc.YdbConst;
import tech.ydb.jdbc.common.TypeDescription;
import tech.ydb.table.query.Params;
import tech.ydb.table.values.PrimitiveType;
import tech.ydb.table.values.Value;
/**
*
* @author Aleksandr Gorshenin
*/
class UInt64JdbcPrm implements JdbcPrm {
private static final TypeDescription DESC = TypeDescription.of(PrimitiveType.Uint64);
private final String name;
private Value> value;
UInt64JdbcPrm(String name) {
this.name = name;
}
@Override
public String getName() {
return this.name;
}
@Override
public void reset() {
value = null;
}
@Override
public void copyToParams(Params params) throws SQLException {
if (value == null) {
throw new SQLException(YdbConst.MISSING_VALUE_FOR_PARAMETER + name);
}
params.put(name, value);
}
@Override
public TypeDescription getType() {
return DESC;
}
@Override
public void setValue(Object obj, int sqlType) throws SQLException {
value = DESC.setters().toValue(obj);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy