summaryrefslogtreecommitdiff
path: root/src/database/QueryUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/QueryUtils.java')
-rw-r--r--src/database/QueryUtils.java86
1 files changed, 37 insertions, 49 deletions
diff --git a/src/database/QueryUtils.java b/src/database/QueryUtils.java
index d0a424d..ceec1e3 100644
--- a/src/database/QueryUtils.java
+++ b/src/database/QueryUtils.java
@@ -12,61 +12,49 @@ import java.sql.SQLException;
*/
public class QueryUtils {
- /**
- * Create an insert tweet.
- *
- * @return A valid database query.
- */
- public static String insertProfile() {
- return "INSERT INTO twitteruser (userid,displayname,timezone,tweetcount,"
- + "followercount,followedcount,location,tweetname,createdat,language) "
- + "SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ? "
- + "WHERE NOT EXISTS "
- + "(SELECT * FROM twitteruser WHERE userid= ? )";
- }
+ public final static String insertProfile
+ = "INSERT INTO twitteruser (userid,displayname,timezone,tweetcount,"
+ + "followercount,followedcount,location,tweetname,createdat,language) "
+ + "SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ? "
+ + "WHERE NOT EXISTS "
+ + "(SELECT * FROM twitteruser WHERE userid= ? )";
- public static String insertTweet() {
- return "INSERT INTO tweet (tweetid,createdat,favcount,retweetcount,text,"
- + "coordinates,language,retweetid,replyid,place) "
- + "SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ? "
- + "WHERE NOT EXISTS "
- + "(SELECT * FROM tweet WHERE tweetid=? )";
- }
+ public final static String insertTweet
+ = "INSERT INTO tweet (tweetid,createdat,favcount,retweetcount,text,"
+ + "coordinates,language,retweetid,replyid,place) "
+ + "SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ? "
+ + "WHERE NOT EXISTS "
+ + "(SELECT * FROM tweet WHERE tweetid=? )";
- public static String insertHash() {
- return "INSERT INTO hashtag (tweetid, hashtag) "
- + "SELECT ?, ? "
- + "WHERE NOT EXISTS "
- + "(SELECT * FROM hashtag WHERE tweetid=? and hashtag =? )";
- }
+ public final static String insertHash
+ = "INSERT INTO hashtag (tweetid, hashtag) "
+ + "SELECT ?, ? "
+ + "WHERE NOT EXISTS "
+ + "(SELECT * FROM hashtag WHERE tweetid=? and hashtag =? )";
- public static String insertUrl() {
- return "INSERT INTO url (tweetid, url) "
- + "SELECT ?, ? "
- + "WHERE NOT EXISTS "
- + "(SELECT * FROM url WHERE tweetid=? and url =? )";
- }
+ public final static String insertUrl
+ = "INSERT INTO url (tweetid, url) "
+ + "SELECT ?, ? "
+ + "WHERE NOT EXISTS "
+ + "(SELECT * FROM url WHERE tweetid=? and url =? )";
- public static String insertMentions() {
- return "INSERT INTO mentionsuser (tweetid, userid) "
- + "SELECT ?, ? "
- + "WHERE NOT EXISTS "
- + "(SELECT * FROM mentionsuser WHERE tweetid=? and userid =? )";
- }
+ public final static String insertMentions
+ = "INSERT INTO mentionsuser (tweetid, userid) "
+ + "SELECT ?, ? "
+ + "WHERE NOT EXISTS "
+ + "(SELECT * FROM mentionsuser WHERE tweetid=? and userid =? )";
- public static String insertPosted() {
- return "INSERT INTO ispostedby (tweetid,userid) "
- + "SELECT ? , ? "
- + "WHERE NOT EXISTS "
- + "(SELECT * FROM ispostedby WHERE tweetid= ? )";
- }
+ public final static String insertPosted
+ = "INSERT INTO ispostedby (tweetid,userid) "
+ + "SELECT ? , ? "
+ + "WHERE NOT EXISTS "
+ + "(SELECT * FROM ispostedby WHERE tweetid= ? )";
- public static String insertBrand() {
- return "INSERT INTO mentionsbrand (tweetid,brand) "
- + "SELECT ? , ? "
- + "WHERE NOT EXISTS "
- + "(SELECT * FROM mentionsbrand WHERE tweetid = ? AND brand = ?)";
- }
+ public final static String insertBrand
+ = "INSERT INTO mentionsbrand (tweetid,brand) "
+ + "SELECT ? , ? "
+ + "WHERE NOT EXISTS "
+ + "(SELECT * FROM mentionsbrand WHERE tweetid = ? AND brand = ?)";
public static void setInsertParams(PreparedStatement tweetStatement,
PreparedStatement profileStatement,