Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. int zZ = 1;
  2. PoolConnection pconp = ConnectionPool.getConnection();
  3. PreparedStatement psp = null;
  4. try {
  5. Connection conp = pconp.connect();
  6. psp = conp.prepareStatement("SELECT count(name) as summe FROM `userteams` where `name` = ?");
  7. psp.setString(1, target.getName());
  8. ResultSet rsp = psp.executeQuery();
  9.  
  10.  
  11. while(rsp.next()) {
  12. if(rsp.getInt("summe") >= 1) {
  13.  
  14. whois.append(String.format("#_Teams_: °%%15°"));
  15. PoolConnection pcon3 = ConnectionPool.getConnection();
  16. PreparedStatement ps3 = null;
  17. try {
  18. Connection con3 = pcon3.connect();
  19. ps3 = con3.prepareStatement("SELECT * FROM `userteams` where name = ?");
  20. ps3.setString(1, target.getName());
  21. ResultSet rs3 = ps3.executeQuery();
  22.  
  23. while(rs3.next()) {
  24. PoolConnection pcon2 = ConnectionPool.getConnection();
  25. PreparedStatement ps2 = null;
  26. try {
  27. Connection con2 = pcon2.connect();
  28. ps2 = con2.prepareStatement("SELECT * FROM `teams` where id = ? order by team");
  29. ps2.setString(1, rs3.getString("team"));
  30. ResultSet rs2 = ps2.executeQuery();
  31. while(rs2.next()) {
  32.  
  33. whois.append((zZ != 1 ? ", " : "")).append("°>_h").append(rs2.getString("team"));
  34. if(rs3.getInt("tl") == 1) {
  35. whois.append(" (Teamleitung)");
  36. }
  37. whois.append("|/h ").append(rs2.getString("team")).append("-team<°");
  38. zZ++;
  39. }
  40. whois.append(String.format("°%%00°"));
  41. } catch (SQLException e) {
  42. e.printStackTrace();
  43. } finally {
  44. if (ps2 != null) {
  45. try {
  46. ps2.close();
  47. } catch (SQLException e) {
  48. }
  49. }
  50.  
  51. pcon2.close();
  52.  
  53. }
  54.  
  55. }
  56.  
  57. } catch (SQLException e) {
  58. e.printStackTrace();
  59. } finally {
  60. if (ps3 != null) {
  61. try {
  62. ps3.close();
  63. } catch (SQLException e) {
  64. }
  65. }
  66.  
  67. pcon3.close();
  68.  
  69. }
  70.  
  71. }
  72.  
  73. }
  74.  
  75. } catch (SQLException e) {
  76. e.printStackTrace();
  77. } finally {
  78. if (psp != null) {
  79. try {
  80. psp.close();
  81. } catch (SQLException e) {
  82. }
  83. }
  84.  
  85. pconp.close();
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement