Exemplo n.º 1
0
 public int queryFolw(User user) {
   int result = 0;
   String sql =
       "SELECT COUNT(user_id) FROM tb_follow WHERE "
           + "user_id="
           + user.GetId()
           + " AND userD_id="
           + user.getDid()
           + ";";
   System.out.println(sql);
   ResultSet resultSet = connDB.executeQuery(sql);
   try {
     while (resultSet.next()) {
       result = resultSet.getInt(1);
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     connDB.close();
   }
   return result;
 }
Exemplo n.º 2
0
 public int queryLike(Reply reply) {
   int result = 0;
   String sql =
       "SELECT COUNT(user_id) FROM tb_like WHERE "
           + "user_id="
           + reply.getUserId()
           + " AND rep_id="
           + reply.getId()
           + ";";
   System.out.println(sql);
   ResultSet resultSet = connDB.executeQuery(sql);
   try {
     while (resultSet.next()) {
       result = resultSet.getInt(1);
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     connDB.close();
   }
   return result;
 }