Guest User

Untitled

a guest
Sep 24th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.82 KB | None | 0 0
  1.  
  2.             Statement stmt = null;
  3.             try {
  4.                 Connection conn_db = DriverManager.getConnection("jdbc:mysql://" + url + "/" + db, user, password);
  5.                 stmt = conn_db.createStatement();
  6.                 ResultSet res = stmt.executeQuery("select count(*) as cnt from queue where session = '" + (String) params[0] + "'");
  7.                 while (res.next()) {
  8.  
  9.                     if (res.getString("CNT").equals("0")) {
  10.                         // check if admin
  11.                         ResultSet resAdmi = stmt.executeQuery("select u.status from users u join sessions s on s.session_id = '"
  12.                                 + (String) params[0] + "'" + " and s.user=u.id");
  13.                         while (resAdmi.next()) {
  14.                             if (!resAdmi.getString("STATUS").equals("20"))
  15.                                 rejectClient("you passed false...");
  16.                         }
  17.                     } else {
  18.                         // Checking for Widgets uploading ready status!
  19.                         int ready = 0;
  20.                         ResultSet resRedy = stmt.executeQuery("select ready from queue where session = '" + (String) params[0] + "'");
  21.                         while (resRedy.next()) {
  22.                             ready = resRedy.getInt("READY");
  23.                         }
  24.                         log.error("READY is :" + Integer.toString(ready));
  25.                         if (ready == 0) {
  26.                             log.error("STARTING THE INITIALIZATION OF RECIV DATA =========== NOT YET READY!!!!");
  27.                         } else if (ready == 1) {
  28.                             log.error("STARTING THE INITIALIZATION OF RECIV DATA");
  29.                             IClient client = conn.getClient();
  30.                             if (params.length > 0) {
  31.                                 client.setAttribute("session_id", (String) params[0]);
  32.                                 if (appScope == conn.getScope())
  33.                                     ConnectionHolder.getInstance().connect(conn);
  34.                             } else
  35.                                 log.error("No params...");
  36.                         }
  37.                     }
  38.                 }
  39.                 stmt.close();
  40.                 stmt = null;
  41.                 conn_db.close();
  42.                 conn_db = null;
  43.  
  44.             } catch (SQLException ex) {
  45.                 log.error("SQLException: " + ex.getMessage());
  46.                 log.error("SQLState: " + ex.getSQLState());
  47.                 log.error("VendorError: " + ex.getErrorCode());
  48.             }
Add Comment
Please, Sign In to add comment