public Object createEntry(Object key) throws Exception { Connection db = null; try { db = CacheUtils.getConnection(context); return new LookupList(db, String.valueOf(key)); } catch (Exception e) { return null; } finally { CacheUtils.freeConnection(context, db); } }
public Object createEntry(Object key) throws Exception { Integer projectId = null; Connection db = null; try { db = CacheUtils.getConnection(context); // Get the project id from its uniqueid PreparedStatement pst = db.prepareStatement("SELECT project_id FROM projects WHERE projecttextid = ? "); pst.setString(1, key.toString()); ResultSet rs = pst.executeQuery(); if (rs.next()) { projectId = rs.getInt("project_id"); } rs.close(); pst.close(); } catch (Exception e) { throw new Exception(e); } finally { CacheUtils.freeConnection(context, db); } return projectId; }