| 7 | private static final String DATABASE = ReadProperty.getValue("mysql.db"); |
| 8 | |
| 9 | public static void saveTweet(String username, String mentionId, String mediaTweetId, String mediaUrl, String thumbnail, String mediaTweetUser, String mediaTweetText, String isSensitive) { |
| 10 | String sql = "INSERT INTO tweet_records(username, mention_id, media_tweet_id, media_url, thumbnail, media_tweet_user, media_tweet_text, is_sensitive) VALUES(?,?,?,?,?,?,?,?)"; |
| 11 | try { |
| 12 | connection = DriverManager.getConnection(DATABASE); |
| 13 | PreparedStatement ps = connection.prepareStatement(sql); |
| 14 | ps.setString(1, username); |
| 15 | ps.setString(2, mentionId); |
| 16 | ps.setString(3, mediaTweetId); |
| 17 | ps.setString(4, mediaUrl); |
| 18 | ps.setString(5, thumbnail); |
| 19 | ps.setString(6,mediaTweetUser); |
| 20 | ps.setString(7,mediaTweetText); |
| 21 | ps.setString(8,isSensitive); |
| 22 | ps.executeUpdate(); |
| 23 | connection.close(); |
| 24 | } catch (SQLException e) { |
| 25 | System.out.println(e.getMessage()); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | public static String getMention(String mentionId) { |
| 30 | StringBuilder mention = new StringBuilder(); |