#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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user