private long executeAddDatasetVersionStatement(PreparedStatement statement, int accountId, int containerId,
      String datasetName, long version, long timeToLiveInSeconds, long creationTimeInMs, Dataset dataset,
      boolean datasetVersionTtlEnabled, DatasetVersionState datasetVersionState) throws SQLException {
    statement.setInt(1, accountId);
    statement.setInt(2, containerId);
    statement.setString(3, datasetName);
    statement.setLong(4, version);
    long updatedExpirationTimeMs;
    if (datasetVersionTtlEnabled || dataset.getRetentionTimeInSeconds() == null) {
      updatedExpirationTimeMs = Utils.addSecondsToEpochTime(creationTimeInMs, timeToLiveInSeconds);
    } else {
      updatedExpirationTimeMs = Utils.addSecondsToEpochTime(creationTimeInMs, dataset.getRetentionTimeInSeconds());
    }
    if (updatedExpirationTimeMs == Infinite_Time) {
      statement.setTimestamp(5, null);
    } else {
      statement.setTimestamp(5, new Timestamp(updatedExpirationTimeMs));
    }
    statement.setInt(6, datasetVersionState.ordinal());
    statement.executeUpdate();
    return updatedExpirationTimeMs;
  }
Execute insert dataset version statement to add a dataset version.
@param statement the mysql statement to add dataset version.
@param accountId the id for the parent account.
@param containerId the id of the container.
@param datasetName the name of the dataset.
@param version the version of the dataset.
@param timeToLiveInSeconds The dataset version level ttl.
@param creationTimeInMs The time at which the blob is created.
@param dataset the {@link Dataset} including the metadata.
@param datasetVersionTtlEnabled set to true if dataset version ttl want to override the dataset level default ttl.
@param datasetVersionState the {@link DatasetVersionState}
@throws SQLException
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java