本文整理了Java中org.jdbi.v3.core.statement.Update.getContext()
方法的一些代码示例,展示了Update.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Update.getContext()
方法的具体详情如下:
包路径:org.jdbi.v3.core.statement.Update
类名称:Update
方法名:getContext
暂无
代码示例来源:origin: jdbi/jdbi
/**
* Executes the update, returning the result obtained from the given {@link ResultProducer}.
*
* @param <R> the result type
* @param producer the result producer.
* @return value returned by the result producer.
*/
public <R> R execute(ResultProducer<R> producer) {
try {
return producer.produce(this::internalExecute, getContext());
} catch (SQLException e) {
try {
close();
} catch (Exception e1) {
e.addSuppressed(e1);
}
throw new UnableToProduceResultException("Could not produce statement result", e, getContext());
}
}
代码示例来源:origin: jdbi/jdbi
public SqlUpdateHandler(Class<?> sqlObjectType, Method method) {
super(sqlObjectType, method);
if (method.isAnnotationPresent(UseRowReducer.class)) {
throw new UnsupportedOperationException("Cannot declare @UseRowReducer on a @SqlUpdate method.");
}
boolean isGetGeneratedKeys = method.isAnnotationPresent(GetGeneratedKeys.class);
QualifiedType<?> returnType = QualifiedType.of(
GenericTypes.resolveType(method.getGenericReturnType(), sqlObjectType))
.with(getQualifiers(method));
if (isGetGeneratedKeys) {
ResultReturner magic = ResultReturner.forMethod(sqlObjectType, method);
String[] columnNames = method.getAnnotation(GetGeneratedKeys.class).value();
this.returner = update -> {
ResultBearing resultBearing = update.executeAndReturnGeneratedKeys(columnNames);
UseRowMapper useRowMapper = method.getAnnotation(UseRowMapper.class);
ResultIterable<?> iterable = useRowMapper == null
? resultBearing.mapTo(returnType)
: resultBearing.map(rowMapperFor(useRowMapper));
return magic.mappedResult(iterable, update.getContext());
};
} else if (isNumeric(method.getReturnType())) {
this.returner = update -> update.execute();
} else if (isBoolean(method.getReturnType())) {
this.returner = update -> update.execute() > 0;
} else {
throw new UnableToCreateSqlObjectException(invalidReturnTypeMessage(method, returnType));
}
}
代码示例来源:origin: org.jdbi/jdbi3
/**
* Executes the update, returning the result obtained from the given {@link ResultProducer}.
*
* @param <R> the result type
* @param producer the result producer.
* @return value returned by the result producer.
*/
public <R> R execute(ResultProducer<R> producer) {
try {
return producer.produce(this::internalExecute, getContext());
} catch (SQLException e) {
try {
close();
} catch (Exception e1) {
e.addSuppressed(e1);
}
throw new UnableToProduceResultException("Could not produce statement result", e, getContext());
}
}
内容来源于网络,如有侵权,请联系作者删除!