|
|
@ -24,50 +24,50 @@ public class dbRealmHandler extends dbHandlerBase { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ConcurrentHashMap<Integer, Realm> LOAD_ALL_REALMS() { |
|
|
|
public ConcurrentHashMap<Integer, Realm> LOAD_ALL_REALMS() { |
|
|
|
|
|
|
|
|
|
|
|
ConcurrentHashMap<Integer, Realm> realmList; |
|
|
|
ConcurrentHashMap<Integer, Realm> realmList; |
|
|
|
Realm thisRealm; |
|
|
|
Realm thisRealm; |
|
|
|
|
|
|
|
|
|
|
|
realmList = new ConcurrentHashMap<>(); |
|
|
|
realmList = new ConcurrentHashMap<>(); |
|
|
|
int recordsRead = 0; |
|
|
|
int recordsRead = 0; |
|
|
|
|
|
|
|
|
|
|
|
prepareCallable("SELECT * FROM obj_realm"); |
|
|
|
prepareCallable("SELECT * FROM obj_realm"); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
ResultSet rs = executeQuery(); |
|
|
|
ResultSet rs = executeQuery(); |
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) { |
|
|
|
while (rs.next()) { |
|
|
|
|
|
|
|
|
|
|
|
recordsRead++; |
|
|
|
recordsRead++; |
|
|
|
thisRealm = new Realm(rs); |
|
|
|
thisRealm = new Realm(rs); |
|
|
|
realmList.put(thisRealm.getRealmID(), thisRealm); |
|
|
|
realmList.put(thisRealm.getRealmID(), thisRealm); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Logger.info( "read: " + recordsRead + " cached: " + realmList.size()); |
|
|
|
Logger.info("read: " + recordsRead + " cached: " + realmList.size()); |
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
} catch (SQLException e) { |
|
|
|
Logger.error(e.getErrorCode() + ' ' + e.getMessage(), e); |
|
|
|
Logger.error(e.getErrorCode() + ' ' + e.getMessage(), e); |
|
|
|
} catch (UnknownHostException ex) { |
|
|
|
} catch (UnknownHostException ex) { |
|
|
|
java.util.logging.Logger.getLogger(dbRealmHandler.class.getName()).log(Level.SEVERE, null, ex); |
|
|
|
java.util.logging.Logger.getLogger(dbRealmHandler.class.getName()).log(Level.SEVERE, null, ex); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
closeCallable(); |
|
|
|
closeCallable(); |
|
|
|
} |
|
|
|
} |
|
|
|
return realmList; |
|
|
|
return realmList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void REALM_UPDATE(Realm realm) { |
|
|
|
public void REALM_UPDATE(Realm realm) { |
|
|
|
|
|
|
|
|
|
|
|
prepareCallable("CALL realm_UPDATE(?,?,?,?)"); |
|
|
|
prepareCallable("CALL realm_UPDATE(?,?,?,?)"); |
|
|
|
|
|
|
|
|
|
|
|
setInt(1, realm.getRealmID()); |
|
|
|
setInt(1, realm.getRealmID()); |
|
|
|
setInt(2, (realm.getRulingCity() == null) ? 0 : realm.getRulingCity().getObjectUUID()); |
|
|
|
setInt(2, (realm.getRulingCity() == null) ? 0 : realm.getRulingCity().getObjectUUID()); |
|
|
|
setInt(3, realm.getCharterType()); |
|
|
|
setInt(3, realm.getCharterType()); |
|
|
|
if (realm.ruledSince != null) |
|
|
|
if (realm.ruledSince != null) |
|
|
|
setLocalDateTime(4, realm.ruledSince); |
|
|
|
setLocalDateTime(4, realm.ruledSince); |
|
|
|
else |
|
|
|
else |
|
|
|
setNULL(4, java.sql.Types.DATE); |
|
|
|
setNULL(4, java.sql.Types.DATE); |
|
|
|
|
|
|
|
|
|
|
|
executeUpdate(); |
|
|
|
executeUpdate(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|