All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.knowm.yank.handlers.InsertedIDResultSetHandler Maven / Gradle / Ivy

There is a newer version: 3.5.0
Show newest version
package org.knowm.yank.handlers;

import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.commons.dbutils.ResultSetHandler;

/**
 * This gets the long value representing the auto-assigned primary key id from the ResultSet object
 * generated from inserting a row.
 *
 * @author timmolter
 */
public class InsertedIDResultSetHandler implements ResultSetHandler {

  public Long handle(ResultSet rs) throws SQLException {

    if (rs.next()) {
      return rs.getLong(1);
    }
    return null;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy