From 84917e8789b9eece2b5ddc2353c3ddcc32a4301e Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 10 May 2014 19:47:48 +0200 Subject: Fix tweetUrl, userUrl table names, fix retweets --- src/database/QueryUtils.java | 4 ++-- src/main/DataFiller.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/database/QueryUtils.java b/src/database/QueryUtils.java index 4f87428..678df8c 100644 --- a/src/database/QueryUtils.java +++ b/src/database/QueryUtils.java @@ -28,10 +28,10 @@ public class QueryUtils { = buildQuery("hashtag", null, "tweetid", "hashtag"); public final static String insertUserUrl - = buildQuery("url", null, "userid", "url"); + = buildQuery("userUrl", null, "userid", "url"); public final static String insertTweetUrl - = buildQuery("url", null, "tweetid", "url"); + = buildQuery("tweetUrl", null, "tweetid", "url"); public final static String insertMentions = buildQuery("mentionsuser", null, "tweetid", "userid"); diff --git a/src/main/DataFiller.java b/src/main/DataFiller.java index 8a010d0..f62bbac 100644 --- a/src/main/DataFiller.java +++ b/src/main/DataFiller.java @@ -52,6 +52,11 @@ public class DataFiller { } public void processTweet(Tweet tweet) throws SQLException { + // process retweets first because of the foreign key. + if (tweet.retweeted_status != null) { + processTweet(tweet.retweeted_status); + } + // ensure that the user and tweet are known before adding relations QueryUtils.setInsertParams(m_insertTweet, m_insertProfile, tweet); m_insertProfile.executeUpdate(); -- cgit v1.2.1