01: /*
02: * Created on 04/09/2006 22:07:16
03: */
04: package net.jforum.dao.generic;
05:
06: import java.sql.PreparedStatement;
07: import java.sql.ResultSet;
08:
09: import net.jforum.JForumExecutionContext;
10: import net.jforum.dao.ApiDAO;
11: import net.jforum.exceptions.DatabaseException;
12: import net.jforum.util.DbUtils;
13: import net.jforum.util.preferences.SystemGlobals;
14:
15: /**
16: * @author Rafael Steil
17: * @version $Id: GenericApiDAO.java,v 1.3 2006/10/10 00:49:03 rafaelsteil Exp $
18: */
19: public class GenericApiDAO implements ApiDAO {
20: /**
21: * @see net.jforum.dao.ApiDAO#isValid(java.lang.String)
22: */
23: public boolean isValid(String apiKey) {
24: boolean status = false;
25:
26: PreparedStatement p = null;
27: ResultSet rs = null;
28:
29: try {
30: p = JForumExecutionContext.getConnection()
31: .prepareStatement(
32: SystemGlobals.getSql("ApiModel.isValid"));
33: p.setString(1, apiKey);
34:
35: rs = p.executeQuery();
36: status = rs.next();
37: } catch (Exception e) {
38: throw new DatabaseException(e);
39: } finally {
40: DbUtils.close(rs, p);
41: }
42:
43: return status;
44: }
45: }
|