aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/CrosspostQueries.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-03-20 02:03:21 +0700
committerGravatar Ugnich Anton2014-03-20 02:03:21 +0700
commit2f56add386e112200dcbd7bdc3f6eefae4c1efb3 (patch)
treedab48fbea282da015ac33e3960ee465a23d08427 /src/com/juick/server/CrosspostQueries.java
parente2c257fecfd08e745c1f051bde14a32a43255f26 (diff)
getVKTokens, messages popularity
Diffstat (limited to 'src/com/juick/server/CrosspostQueries.java')
-rw-r--r--src/com/juick/server/CrosspostQueries.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/com/juick/server/CrosspostQueries.java b/src/com/juick/server/CrosspostQueries.java
index 09d951c1..fd677048 100644
--- a/src/com/juick/server/CrosspostQueries.java
+++ b/src/com/juick/server/CrosspostQueries.java
@@ -34,7 +34,7 @@ public class CrosspostQueries {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
- stmt = sql.prepareStatement("SELECT access_token,access_token_secret FROM twitter WHERE user_id=?");
+ stmt = sql.prepareStatement("SELECT access_token,access_token_secret FROM twitter WHERE user_id=? AND crosspost=1");
stmt.setInt(1, uid);
rs = stmt.executeQuery();
if (rs.first()) {
@@ -54,4 +54,27 @@ public class CrosspostQueries {
public static String getFacebookToken(Connection sql, int uid) {
return SQLHelpers.getString(sql, "SELECT access_token FROM facebook WHERE user_id=? AND access_token IS NOT NULL AND crosspost=1", uid);
}
+
+ public static String[] getVKTokens(Connection sql, int uid) {
+ String tokens[] = null;
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT vk_id,access_token FROM vk WHERE user_id=? AND crosspost=1");
+ stmt.setInt(1, uid);
+ rs = stmt.executeQuery();
+ if (rs.first()) {
+ tokens = new String[2];
+ tokens[0] = rs.getString(1);
+ tokens[1] = rs.getString(2);
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ return tokens;
+ }
}