Exemple #1
0
 public synchronized void deleteAllRooms() {
   try {
     Statement stmt = con.createStatement();
     String sql = "DELETE FROM " + tableName + "";
     stmt.executeUpdate(sql);
   } catch (SQLException ex) {
     Logger.writeToFile("Exception occured " + ex.toString());
   }
 }
Exemple #2
0
 public synchronized ResultSet findRoomById(int roomId) {
   try {
     Statement stmt = con.createStatement();
     String sql = "SELECT * FROM " + tableName + "WHERE `roomId`=" + roomId + "";
     ResultSet rs = stmt.executeQuery(sql);
   } catch (SQLException ex) {
     Logger.writeToFile("Exception occured " + ex.toString());
   }
   return null;
 }
Exemple #3
0
 public synchronized ResultSet getAllChatUsers(int id) {
   try {
     Statement stmt = con.createStatement();
     String sql =
         "SELECT users_tbl.login, users_tbl.userId FROM chatroom_tbl,chatuser_tbl,users_tbl "
             + "WHERE chatroom_tbl.chatRoomId = chatuser_tbl.chatRoomId "
             + "AND chatuser_tbl.chatUserId = users_tbl.userId AND chatroom_tbl.chatRoomId = "
             + id
             + "";
     ResultSet rs = stmt.executeQuery(sql);
   } catch (Exception ex) {
     Logger.writeToFile("Exception occured " + ex.toString());
   }
   return null;
 }
Exemple #4
0
 public synchronized ResultSet findRoomCreator(String roomname, String creatorName) {
   try {
     Connection conn = Db.getInstance().createConnection();
     Statement stmt = con.createStatement();
     String sql =
         "SELECT '"
             + creatorName
             + "' FROM "
             + tableName
             + " WHERE `roomname` ='"
             + roomname
             + "'";
     ResultSet rs = stmt.executeQuery(sql);
   } catch (SQLException ex) {
     Logger.writeToFile("Exception occured " + ex.toString());
   }
   return null;
 }