Files
Server/src/engine/db/handlers/dbItemBaseHandler.java
T

52 lines
1.7 KiB
Java
Raw Normal View History

2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.db.handlers;
2023-05-21 08:36:39 -04:00
import engine.gameManager.DbManager;
2022-04-30 09:41:17 -04:00
import engine.objects.ItemBase;
import org.pmw.tinylog.Logger;
2023-05-21 08:36:39 -04:00
import java.sql.Connection;
import java.sql.PreparedStatement;
2022-04-30 09:41:17 -04:00
import java.sql.ResultSet;
import java.sql.SQLException;
public class dbItemBaseHandler extends dbHandlerBase {
2023-05-23 10:27:03 -04:00
public dbItemBaseHandler() {
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void LOAD_ALL_ITEMBASES() {
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
ItemBase itemBase;
int recordsRead = 0;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_itembase")) {
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
ResultSet rs = preparedStatement.executeQuery();
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
while (rs.next()) {
recordsRead++;
itemBase = new ItemBase(rs);
2024-02-07 19:20:29 -06:00
2023-07-15 09:23:48 -04:00
ItemBase.addToCache(itemBase);
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
} catch (SQLException e) {
Logger.error(e);
}
2023-05-21 08:36:39 -04:00
2023-07-15 09:23:48 -04:00
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
}
2024-02-07 19:33:37 -06:00
2022-04-30 09:41:17 -04:00
}