java.sql.ResultSet.updateRow()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(237)

本文整理了Java中java.sql.ResultSet.updateRow方法的一些代码示例,展示了ResultSet.updateRow的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.updateRow方法的具体详情如下:
包路径:java.sql.ResultSet
类名称:ResultSet
方法名:updateRow

ResultSet.updateRow介绍

[英]Updates the database with the new contents of the current row of this ResultSet object.
[中]使用此ResultSet对象当前行的新内容更新数据库。

代码示例

代码示例来源:origin: querydsl/querydsl

@Override
public void updateRow() throws SQLException {
  rs.updateRow();
}

代码示例来源:origin: codingapi/tx-lcn

@Override
public void updateRow() throws SQLException {
 delegate.updateRow();
}

代码示例来源:origin: alibaba/druid

@Override
public void updateRow() throws SQLException {
  try {
    rs.updateRow();
  } catch (Throwable t) {
    throw checkException(t);
  }
}

代码示例来源:origin: apache/ignite

@Override public void run() throws Exception {
    rs.updateRow();
  }
});

代码示例来源:origin: com.zaxxer/HikariCP

/** {@inheritDoc} */
@Override
public void updateRow() throws SQLException
{
 connection.markCommitStateDirty();
 delegate.updateRow();
}

代码示例来源:origin: alibaba/druid

@Override
public void resultSet_updateRow(ResultSetProxy resultSet) throws SQLException {
  if (this.pos < filterSize) {
    nextFilter().resultSet_updateRow(this, resultSet);
    return;
  }
  resultSet.getResultSetRaw().updateRow();
}

代码示例来源:origin: apache/groovy

/**
 * Moves the cursor down one row from its current position.
 * A <code>getResultSet()</code> cursor is initially positioned
 * before the first row; the first call to the method
 * <code>next</code> makes the first row the current row; the
 * second call makes the second row the current row, and so on.
 * <p>
 * <P>If an input stream is open for the current row, a call
 * to the method <code>next</code> will
 * implicitly close it. A <code>getResultSet()</code> object's
 * warning chain is cleared when a new row is read.
 *
 * @return <code>true</code> if the new current row is valid;
 *         <code>false</code> if there are no more rows
 * @throws SQLException if a database access error occurs
 */
public boolean next() throws SQLException {
  if (updated) {
    getResultSet().updateRow();
    updated = false;
  }
  return getResultSet().next();
}

代码示例来源:origin: apache/groovy

/**
 * Moves the cursor to the previous row in this
 * <code>getResultSet()</code> object.
 *
 * @return <code>true</code> if the cursor is on a valid row;
 *         <code>false</code> if it is off the result set
 * @throws SQLException if a database access error
 *                      occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
 * @since 1.2
 */
public boolean previous() throws SQLException {
  if (updated) {
    getResultSet().updateRow();
    updated = false;
  }
  return getResultSet().previous();
}

代码示例来源:origin: apache/activemq

private void updateBlob(Connection connection, String findMessageByIdStatement, long sequence, byte[] data) throws SQLException, IOException {
  PreparedStatement s = null;
  ResultSet rs = null;
  try {
    s = connection.prepareStatement(statements.getFindMessageByIdStatement(),
      ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
    s.setLong(1, sequence);
    rs = s.executeQuery();
    if (!rs.next()) {
      throw new IOException("Failed select blob for message: " + sequence + " in container.");
    }
    // Update the blob
    Blob blob = rs.getBlob(1);
    blob.truncate(0);
    blob.setBytes(1, data);
    rs.updateBlob(1, blob);
    rs.updateRow();             // Update the row with the updated blob
  } finally {
    close(rs);
    close(s);
  }
}

代码示例来源:origin: com.h2database/h2

rs.insertRow();
} else {
  rs.updateRow();

代码示例来源:origin: spring-projects/spring-framework

verify(resultSet).updateString(2, "Rod");
verify(resultSet).updateString(2, "Thomas");
verify(resultSet, times(2)).updateRow();
verify(preparedStatement).setObject(1, 2, Types.NUMERIC);
verify(resultSet).close();

代码示例来源:origin: p6spy/p6spy

@Override
public void updateRow() throws SQLException {
 delegate.updateRow();
}

代码示例来源:origin: Meituan-Dianping/Zebra

@Override
public void updateRow() throws SQLException {
  innerResultSet.updateRow();
}

代码示例来源:origin: Meituan-Dianping/Zebra

@Override
public void updateRow() throws SQLException {
  innerResultSet.updateRow();
}

代码示例来源:origin: apache/phoenix

@Override
public void updateRow() throws SQLException {
  rs.updateRow();
}

代码示例来源: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: 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 updateRow() throws SQLException {
  try {
    rs.updateRow();
  } catch (Throwable t) {
    throw checkException(t);
  }
}

代码示例来源:origin: stackoverflow.com

public static void updateBlobColumn(Connection con, String table, String blobColumn, byte[] inputBytes, String idColumn, Long id) throws SQLException {
 PreparedStatement pStmt = null;
 ResultSet rs = null;
 try {
  String sql = 
   " SELECT " + blobColumn + 
   " FROM " + table + 
   " WHERE " + idColumn + " = ? " +
   " FOR UPDATE";
  pStmt = con.prepareStatement(sql, 
   ResultSet.TYPE_FORWARD_ONLY, 
   ResultSet.CONCUR_UPDATABLE);
  pStmt.setLong(1, id);
  rs = pStmt.executeQuery();
  if (rs.next()) {
   Blob blob = rs.getBlob(blobColumn);
   blob.truncate(0);
   blob.setBytes(1, inputBytes);
   rs.updateBlob(blobColumn, blob);
   rs.updateRow();
  }
 }
 finally {
  if(rs != null) rs.close();
  if(pStmt != null) pStmt.close();
 }
}

代码示例来源:origin: com.alibaba/druid

@Override
public void resultSet_updateRow(ResultSetProxy resultSet) throws SQLException {
  if (this.pos < filterSize) {
    nextFilter().resultSet_updateRow(this, resultSet);
    return;
  }
  resultSet.getResultSetRaw().updateRow();
}

相关文章

微信公众号

最新文章

更多

ResultSet类方法