All pastes #500884 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-21 19:49 UTC
rendered paste body
/**
	 * Request a tag id by providing the comment id. On success it returns the tag id,
	 * on failure this function will return 0
	 * 
	 * @param 	cid	comment id
	 * @return	tag id on success, 0 on failure
	 */
	public int getTagIdByCommentId(int cid) {
		String sql = "SELECT taggedid FROM " + getTagTable() + " WHERE commentid = '" + cid + "' AND sectionid = '" + getSectionId() + "'";
		
		try {
			ResultSet rs2 = select(sql);
			if(! rs2.next()) { System.out.println("dddd"); return 0;}
			int tid = rs2.getInt("taggedid");
			rs2.close();
			
			return tid;
		} catch (SQLException e) {
			e.printStackTrace();
			
			return 0;
		} 
	}