本文整理了Java中java.sql.ResultSet.updateString
方法的一些代码示例,展示了ResultSet.updateString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.updateString
方法的具体详情如下:
包路径:java.sql.ResultSet
类名称:ResultSet
方法名:updateString
[英]Updates a column specified by a column index with a String value.
[中]使用字符串值更新列索引指定的列。
代码示例来源:origin: querydsl/querydsl
@Override
public void updateString(int columnIndex, String x) throws SQLException {
rs.updateString(columnIndex, x);
}
代码示例来源:origin: querydsl/querydsl
@Override
public void updateString(String columnLabel, String x) throws SQLException {
rs.updateString(columnLabel, x);
}
代码示例来源:origin: codingapi/tx-lcn
@Override
public void updateString(int columnIndex, String x) throws SQLException {
delegate.updateString(columnIndex, x);
}
代码示例来源:origin: codingapi/tx-lcn
@Override
public void updateString(String columnLabel, String x) throws SQLException {
delegate.updateString(columnLabel, x);
}
代码示例来源:origin: alibaba/druid
@Override
public void updateString(int columnIndex, String x) throws SQLException {
try {
rs.updateString(columnIndex, x);
} catch (Throwable t) {
throw checkException(t);
}
}
代码示例来源:origin: alibaba/druid
@Override
public void updateString(String columnLabel, String x) throws SQLException {
try {
rs.updateString(columnLabel, x);
} catch (Throwable t) {
throw checkException(t);
}
}
代码示例来源:origin: spotbugs/spotbugs
@NoWarning("SQL")
public void test3(ResultSet rs) throws SQLException {
String s = rs.getString("foo");
s = s.substring(1);
rs.updateString("foo", s);
}
代码示例来源:origin: spotbugs/spotbugs
@ExpectWarning("SQL")
public void test2(ResultSet rs) throws SQLException {
String s = rs.getString(0);
s = s.substring(1);
rs.updateString(0, s);
}
代码示例来源:origin: apache/ignite
@Override public void run() throws Exception {
rs.updateString("id", "");
}
});
代码示例来源:origin: apache/ignite
@Override public void run() throws Exception {
rs.updateString(1, "");
}
});
代码示例来源:origin: alibaba/druid
@Override
public void resultSet_updateString(ResultSetProxy resultSet, String columnLabel, String x) throws SQLException {
if (this.pos < filterSize) {
nextFilter().resultSet_updateString(this, resultSet, columnLabel, x);
return;
}
resultSet.getResultSetRaw().updateString(columnLabel, x);
}
代码示例来源:origin: alibaba/druid
@Override
public void resultSet_updateString(ResultSetProxy resultSet, int columnIndex, String x) throws SQLException {
if (this.pos < filterSize) {
nextFilter().resultSet_updateString(this, resultSet, columnIndex, x);
return;
}
resultSet.getResultSetRaw().updateString(columnIndex, x);
}
代码示例来源:origin: com.h2database/h2
switch (type) {
case Types.TIME:
rs.updateString(columnIndex, "12:00:00");
break;
case Types.TIMESTAMP:
case Types.DATE:
rs.updateString(columnIndex, "2001-01-01");
break;
default:
rs.updateString(columnIndex, "1");
break;
int type = meta.getColumnType(columnIndex);
if (session.getContents().isH2()) {
rs.updateString(columnIndex, x);
return;
break;
default:
rs.updateString(columnIndex, x);
代码示例来源:origin: AxonFramework/AxonFramework
/**
* Tries to claim the given token {@code entry}. If the claim fails an {@link UnableToClaimTokenException} should be
* thrown. Otherwise the given {@code resultSet} should be updated to reflect the claim.
*
* @param resultSet the updatable query result of an executed {@link PreparedStatement}
* @param entry the entry extracted from the given result set
* @return the claimed tracking token
*
* @throws UnableToClaimTokenException if the token cannot be claimed because another node currently owns the token
* @throws SQLException when an exception occurs while claiming the token entry
*/
protected TrackingToken claimToken(ResultSet resultSet, AbstractTokenEntry<?> entry) throws SQLException {
if (!entry.claim(nodeId, claimTimeout)) {
throw new UnableToClaimTokenException(
format("Unable to claim token '%s[%s]'. It is owned by '%s'", entry.getProcessorName(),
entry.getSegment(), entry.getOwner()));
}
resultSet.updateString(schema.ownerColum(), entry.getOwner());
resultSet.updateString(schema.timestampColumn(), entry.timestampAsString());
resultSet.updateRow();
return entry.getToken(serializer);
}
代码示例来源:origin: spring-projects/spring-framework
values.put(2, "Thomas");
query.execute(2, values);
verify(resultSet).updateString(2, "Rod");
verify(resultSet).updateString(2, "Thomas");
verify(resultSet, times(2)).updateRow();
verify(preparedStatement).setObject(1, 2, Types.NUMERIC);
代码示例来源:origin: AxonFramework/AxonFramework
/**
* Inserts a new token entry via the given updatable {@code resultSet}.
*
* @param resultSet the updatable result set to add the entry to
* @param token the token of the entry to insert
* @param processorName the name of the processor to insert a token for
* @param segment the segment of the processor to insert a token for
* @return the tracking token of the inserted entry
*
* @throws SQLException when an exception occurs while inserting a token entry
*/
protected TrackingToken insertTokenEntry(ResultSet resultSet, TrackingToken token, String processorName,
int segment) throws SQLException {
AbstractTokenEntry<?> entry = new GenericTokenEntry<>(token, serializer, contentType, processorName, segment);
entry.claim(nodeId, claimTimeout);
resultSet.moveToInsertRow();
resultSet.updateObject(schema.tokenColumn(), token == null ? null : entry.getSerializedToken().getData());
resultSet.updateString(schema.tokenTypeColumn(),
token == null ? null : entry.getSerializedToken().getType().getName());
resultSet.updateString(schema.timestampColumn(), entry.timestampAsString());
resultSet.updateString(schema.ownerColum(), entry.getOwner());
resultSet.updateString(schema.processorNameColumn(), processorName);
resultSet.updateInt(schema.segmentColumn(), segment);
resultSet.insertRow();
return token;
}
代码示例来源:origin: AxonFramework/AxonFramework
/**
* If the given {@code resultSet} has no items this method should insert a new token entry. If a token already
* exists it should be attempted to replace the token in the entry with the given {@code token} and claim ownership.
*
* @param resultSet the updatable query result set of an executed {@link PreparedStatement}
* @param token the token for the new or updated entry
* @param processorName the name of the processor owning the token
* @param segment the segment of the processor owning the token
* @throws UnableToClaimTokenException if the token cannot be claimed because another node currently owns the token
* @throws SQLException when an exception occurs while updating the result set
*/
protected void insertOrUpdateToken(ResultSet resultSet, TrackingToken token, String processorName,
int segment) throws SQLException {
if (resultSet.next()) {
AbstractTokenEntry<?> entry = readTokenEntry(resultSet);
entry.updateToken(token, serializer);
resultSet.updateObject(schema.tokenColumn(), entry.getSerializedToken().getData());
resultSet.updateString(schema.tokenTypeColumn(), entry.getSerializedToken().getType().getName());
resultSet.updateString(schema.timestampColumn(), entry.timestampAsString());
claimToken(resultSet, entry);
} else {
insertTokenEntry(resultSet, token, processorName, segment);
}
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testConcurrentUpdateableResultSet() {
handle.execute("create table something (id identity primary key, name varchar(50))");
handle.execute("insert into something (id, name) values (7, 'Tim')");
handle.createQuery("select id, name from something where id = :id")
.bind("id", 7)
.concurrentUpdatable()
.map((r, ctx) -> {
r.updateString("name", "Tom");
r.updateRow();
return null;
}).list();
final String name = handle.createQuery("select name from something where id = :id")
.bind("id", 7)
.mapTo(String.class)
.findOnly();
assertThat(name).isEqualTo("Tom");
}
}
代码示例来源:origin: com.alibaba/druid
@Override
public void updateString(String columnLabel, String x) throws SQLException {
try {
rs.updateString(columnLabel, x);
} catch (Throwable t) {
throw checkException(t);
}
}
代码示例来源:origin: com.alibaba/druid
@Override
public void updateString(int columnIndex, String x) throws SQLException {
try {
rs.updateString(columnIndex, x);
} catch (Throwable t) {
throw checkException(t);
}
}
内容来源于网络,如有侵权,请联系作者删除!