#792 Add columns for registration IP and registration date

- Add columns for reg date and IP
- Rename "ip" to "last IP"
This commit is contained in:
ljacqu
2017-10-14 17:37:34 +02:00
parent 1487fc0d9e
commit 52d6476058
37 changed files with 362 additions and 235 deletions
@@ -2,6 +2,7 @@ package fr.xephi.authme.datasource;
import fr.xephi.authme.ConsoleLogger;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
@@ -20,4 +21,18 @@ final class SqlDataSourceUtils {
static void logSqlException(SQLException e) {
ConsoleLogger.logException("Error during SQL operation:", e);
}
/**
* Returns the long value of a column, or null when appropriate. This method is necessary because
* JDBC's {@link ResultSet#getLong} returns {@code 0} if the entry in the database is {@code null}.
*
* @param rs the result set to read from
* @param columnName the name of the column to retrieve
* @return the value (which may be null)
* @throws SQLException :)
*/
static Long getNullableLong(ResultSet rs, String columnName) throws SQLException {
long longValue = rs.getLong(columnName);
return rs.wasNull() ? null : longValue;
}
}