private void executeCopyToNewDatasetVersionStatement(PreparedStatement statement, int accountId, int containerId,
      String datasetName, long sourceVersionValue, long targetVersionValue, String renameFrom)
      throws SQLException, AccountServiceException {
    statement.setLong(1, targetVersionValue);
    statement.setString(2, renameFrom);
    statement.setInt(3, accountId);
    statement.setInt(4, containerId);
    statement.setString(5, datasetName);
    statement.setLong(6, sourceVersionValue);
    statement.setInt(7, DatasetVersionState.READY.ordinal());
    int count = statement.executeUpdate();
    if (count <= 0) {
      throw new AccountServiceException(
          "Can't find source version to rename for account: " + accountId + " container: " + containerId + " dataset: "
              + datasetName + " version: " + sourceVersionValue, AccountServiceErrorCode.NotFound);
    }
  }
Execute CopyToNewDatasetVersionStatement to copy the source version to a target version.
@param statement the rename dataset statement.
@param accountId the id for the parent account.
@param containerId the id of the container.
@param datasetName the name of the dataset.
@param sourceVersionValue the long value of source version.
@param targetVersionValue the long value of target version.
@throws SQLException
@throws AccountServiceException
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java