* world and list of EnvironmentType that is to say list of environments
* belonging to the world. If no world found in database returns null.
* @throws SQLException
*/
public static World getWorldByName(String name) throws SQLException {
World world = null;
String query = "SELECT * FROM `world` WHERE `game_name` = ?";
Connection connection = null;
PreparedStatement pstmt = null;
try {
connection = DAO.getDataSource().getConnection();
pstmt = connection.prepareStatement(query);
pstmt.setString(1, name);
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
world = new World(rs.getInt("world_id"));
world.setGameName(rs.getString("game_name"));
world.setPlayTime(rs.getInt("play_time"));
world.setTimeRate(rs.getFloat("time_rate"));
world.setSeconds(rs.getLong("seconds"));
world.setYear(rs.getInt("year"));
world.setMonth(rs.getInt("month"));
world.setDays(rs.getInt("days"));
world.setMaxPlayers(rs.getInt("max_players"));
world.setEnvType(rs.getString("env_type"));
world.setAccessType(rs.getShort("access_type"));
world.setGameMode(rs.getShort("game_mode"));
world.setCreatorID(rs.getInt("creator_id"));
world.setPassword(rs.getString("password"));
}
rs.close();
pstmt.close();
} finally {