Class StorageUtils
java.lang.Object
me.confuser.banmanager.common.util.StorageUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconvertIpColumn(BanManagerPlugin plugin, String table, String column) static voidconvertIpColumn(BanManagerPlugin plugin, String table, String column, String idType) static voidupdateTimestampsToDbTime(me.confuser.banmanager.common.ormlite.dao.BaseDaoImpl<?, ?> dao, DatabaseConfig dbConfig, String tableName, int id, boolean hasUpdated) Updates the created and updated timestamps to database time using the DAO.static voidupdateTimestampsToDbTime(me.confuser.banmanager.common.ormlite.support.ConnectionSource connectionSource, DatabaseConfig dbConfig, String tableName, int id, boolean hasUpdated)
-
Constructor Details
-
StorageUtils
public StorageUtils()
-
-
Method Details
-
updateTimestampsToDbTime
public static void updateTimestampsToDbTime(me.confuser.banmanager.common.ormlite.dao.BaseDaoImpl<?, ?> dao, DatabaseConfig dbConfig, String tableName, int id, boolean hasUpdated) throws SQLExceptionUpdates the created and updated timestamps to database time using the DAO. This ensures timestamps are always from the database, not the JVM, for cross-server sync. Uses the DAO's executeRaw to avoid connection pool issues.- Parameters:
dao- the DAO to use for executing the updatedbConfig- the database config (provides timestamp expression)tableName- the table nameid- the generated ID of the inserted rowhasUpdated- whether the table has an 'updated' column- Throws:
SQLException- if the update fails
-
updateTimestampsToDbTime
public static void updateTimestampsToDbTime(me.confuser.banmanager.common.ormlite.support.ConnectionSource connectionSource, DatabaseConfig dbConfig, String tableName, int id, boolean hasUpdated) throws SQLException - Throws:
SQLException
-
convertIpColumn
-
convertIpColumn
public static void convertIpColumn(BanManagerPlugin plugin, String table, String column, String idType)
-