aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/juick/server/TagQueries.java49
1 files changed, 35 insertions, 14 deletions
diff --git a/src/com/juick/server/TagQueries.java b/src/com/juick/server/TagQueries.java
index b570c32a..938f7ace 100644
--- a/src/com/juick/server/TagQueries.java
+++ b/src/com/juick/server/TagQueries.java
@@ -29,10 +29,10 @@ import java.util.ArrayList;
* @author Ugnich Anton
*/
public class TagQueries {
-
+
public static com.juick.Tag getTag(Connection sql, String tag, boolean autoCreate) {
com.juick.Tag ret = null;
-
+
PreparedStatement stmt = null;
ResultSet rs = null;
try {
@@ -50,32 +50,53 @@ public class TagQueries {
} finally {
Utils.finishSQL(rs, stmt);
}
-
+
if (ret == null && autoCreate) {
ret = new com.juick.Tag();
ret.TID = createTag(sql, tag);
ret.Name = tag;
}
-
+
return ret;
}
-
+
public static ArrayList<com.juick.Tag> getTags(Connection sql, String[] tags, boolean autoCreate) {
ArrayList<com.juick.Tag> ret = new ArrayList<com.juick.Tag>();
-
+
for (int i = 0; i < tags.length; i++) {
com.juick.Tag t = getTag(sql, tags[i], autoCreate);
if (t != null) {
ret.add(t);
}
}
-
+
+ return ret;
+ }
+
+ public static boolean getTagNoIndex(Connection sql, int tag_id) {
+ boolean ret = false;
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT noindex FROM tags_meta WHERE tag_id=?");
+ stmt.setInt(1, tag_id);
+ rs = stmt.executeQuery();
+ if (rs.first()) {
+ ret = rs.getInt(1) == 1;
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
return ret;
}
-
+
public static int createTag(Connection sql, String name) {
int ret = 0;
-
+
PreparedStatement stmt = null;
ResultSet rs = null;
try {
@@ -91,13 +112,13 @@ public class TagQueries {
} finally {
Utils.finishSQL(rs, stmt);
}
-
+
return ret;
}
-
+
public static ArrayList<com.juick.Tag> getUserTagsAll(Connection sql, int uid) {
ArrayList<com.juick.Tag> tags = new ArrayList<com.juick.Tag>();
-
+
PreparedStatement stmt = null;
ResultSet rs = null;
try {
@@ -118,10 +139,10 @@ public class TagQueries {
}
return tags;
}
-
+
public static ArrayList<String> getUserBLTags(Connection sql, int uid) {
ArrayList<String> tags = new ArrayList<String>();
-
+
PreparedStatement stmt = null;
ResultSet rs = null;
try {