private boolean isTriggerStillPresent(PreparedStatement ps) throws SQLException { ResultSet rs = null; try { rs = ps.executeQuery(); return rs.next(); } finally { closeResultSet(rs); } }
private boolean isTriggerStillPresent(PreparedStatement ps) throws SQLException { ResultSet rs = null; try { rs = ps.executeQuery(); return rs.next(); } finally { closeResultSet(rs); } }
public boolean isTriggerGroupPaused(Connection conn, String groupName) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_PAUSED_TRIGGER_GROUP)); ps.setString(1, groupName); rs = ps.executeQuery(); return rs.next(); } finally { closeResultSet(rs); closeStatement(ps); } }
public boolean isTriggerGroupPaused(Connection conn, String groupName) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_PAUSED_TRIGGER_GROUP)); ps.setString(1, groupName); rs = ps.executeQuery(); return rs.next(); } finally { closeResultSet(rs); closeStatement(ps); } }
public boolean isExistingTriggerGroup(Connection conn, String groupName) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_NUM_TRIGGERS_IN_GROUP)); ps.setString(1, groupName); rs = ps.executeQuery(); if (!rs.next()) { return false; } return (rs.getInt(1) > 0); } finally { closeResultSet(rs); closeStatement(ps); } }
public boolean isExistingTriggerGroup(Connection conn, String groupName) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_NUM_TRIGGERS_IN_GROUP)); ps.setString(1, groupName); rs = ps.executeQuery(); if (!rs.next()) { return false; } return (rs.getInt(1) > 0); } finally { closeResultSet(rs); closeStatement(ps); } }
/** * @see org.quartz.impl.jdbcjobstore.DriverDelegate#selectPausedTriggerGroups(java.sql.Connection) */ public Set<String> selectPausedTriggerGroups(Connection conn) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; HashSet<String> set = new HashSet<String>(); try { ps = conn.prepareStatement(rtp(SELECT_PAUSED_TRIGGER_GROUPS)); rs = ps.executeQuery(); while (rs.next()) { String groupName = rs.getString(COL_TRIGGER_GROUP); set.add(groupName); } return set; } finally { closeResultSet(rs); closeStatement(ps); } }
/** * @see org.quartz.impl.jdbcjobstore.DriverDelegate#selectPausedTriggerGroups(java.sql.Connection) */ public Set<String> selectPausedTriggerGroups(Connection conn) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; HashSet<String> set = new HashSet<String>(); try { ps = conn.prepareStatement(rtp(SELECT_PAUSED_TRIGGER_GROUPS)); rs = ps.executeQuery(); while (rs.next()) { String groupName = rs.getString(COL_TRIGGER_GROUP); set.add(groupName); } return set; } finally { closeResultSet(rs); closeStatement(ps); } }
public List<String> selectTriggerGroups(Connection conn, GroupMatcher<TriggerKey> matcher) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_TRIGGER_GROUPS_FILTERED)); ps.setString(1, toSqlLikeClause(matcher)); rs = ps.executeQuery(); LinkedList<String> list = new LinkedList<String>(); while (rs.next()) { list.add(rs.getString(1)); } return list; } finally { closeResultSet(rs); closeStatement(ps); } }
public List<String> selectTriggerGroups(Connection conn, GroupMatcher<TriggerKey> matcher) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_TRIGGER_GROUPS_FILTERED)); ps.setString(1, toSqlLikeClause(matcher)); rs = ps.executeQuery(); LinkedList<String> list = new LinkedList<String>(); while (rs.next()) { list.add(rs.getString(1)); } return list; } finally { closeResultSet(rs); closeStatement(ps); } }
public List<TriggerKey> selectMisfiredTriggersInState(Connection conn, String state, long ts) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_MISFIRED_TRIGGERS_IN_STATE)); ps.setBigDecimal(1, new BigDecimal(String.valueOf(ts))); ps.setString(2, state); rs = ps.executeQuery(); LinkedList<TriggerKey> list = new LinkedList<TriggerKey>(); while (rs.next()) { String triggerName = rs.getString(COL_TRIGGER_NAME); String groupName = rs.getString(COL_TRIGGER_GROUP); list.add(triggerKey(triggerName, groupName)); } return list; } finally { closeResultSet(rs); closeStatement(ps); } }
public int selectJobExecutionCount(Connection conn, JobKey jobKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_JOB_EXECUTION_COUNT)); ps.setString(1, jobKey.getName()); ps.setString(2, jobKey.getGroup()); rs = ps.executeQuery(); return (rs.next()) ? rs.getInt(1) : 0; } finally { closeResultSet(rs); closeStatement(ps); } }
public List<TriggerKey> selectMisfiredTriggersInState(Connection conn, String state, long ts) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_MISFIRED_TRIGGERS_IN_STATE)); ps.setBigDecimal(1, new BigDecimal(String.valueOf(ts))); ps.setString(2, state); rs = ps.executeQuery(); LinkedList<TriggerKey> list = new LinkedList<TriggerKey>(); while (rs.next()) { String triggerName = rs.getString(COL_TRIGGER_NAME); String groupName = rs.getString(COL_TRIGGER_GROUP); list.add(triggerKey(triggerName, groupName)); } return list; } finally { closeResultSet(rs); closeStatement(ps); } }
public int selectJobExecutionCount(Connection conn, JobKey jobKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_JOB_EXECUTION_COUNT)); ps.setString(1, jobKey.getName()); ps.setString(2, jobKey.getGroup()); rs = ps.executeQuery(); return (rs.next()) ? rs.getInt(1) : 0; } finally { closeResultSet(rs); closeStatement(ps); } }
/** * <p> * Select all of the job group names that are stored. * </p> * * @param conn * the DB Connection * @return an array of <code>String</code> group names */ public List<String> selectJobGroups(Connection conn) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_JOB_GROUPS)); rs = ps.executeQuery(); LinkedList<String> list = new LinkedList<String>(); while (rs.next()) { list.add(rs.getString(1)); } return list; } finally { closeResultSet(rs); closeStatement(ps); } }
public List<OperableTrigger> selectTriggersForCalendar(Connection conn, String calName) throws SQLException, ClassNotFoundException, IOException, JobPersistenceException { LinkedList<OperableTrigger> trigList = new LinkedList<OperableTrigger>(); PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_TRIGGERS_FOR_CALENDAR)); ps.setString(1, calName); rs = ps.executeQuery(); while (rs.next()) { trigList.add(selectTrigger(conn, triggerKey(rs.getString(COL_TRIGGER_NAME), rs.getString(COL_TRIGGER_GROUP)))); } } finally { closeResultSet(rs); closeStatement(ps); } return trigList; }
public List<OperableTrigger> selectTriggersForCalendar(Connection conn, String calName) throws SQLException, ClassNotFoundException, IOException, JobPersistenceException { LinkedList<OperableTrigger> trigList = new LinkedList<OperableTrigger>(); PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_TRIGGERS_FOR_CALENDAR)); ps.setString(1, calName); rs = ps.executeQuery(); while (rs.next()) { trigList.add(selectTrigger(conn, triggerKey(rs.getString(COL_TRIGGER_NAME), rs.getString(COL_TRIGGER_GROUP)))); } } finally { closeResultSet(rs); closeStatement(ps); } return trigList; }
/** * <p> * Select the total number of calendars stored. * </p> * * @param conn * the DB Connection * @return the total number of calendars stored */ public int selectNumCalendars(Connection conn) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { int count = 0; ps = conn.prepareStatement(rtp(SELECT_NUM_CALENDARS)); rs = ps.executeQuery(); if (rs.next()) { count = rs.getInt(1); } return count; } finally { closeResultSet(rs); closeStatement(ps); } }
/** * <p> * Check whether or not the given job is stateful. * </p> * * @param conn * the DB Connection * @return true if the job exists and is stateful, false otherwise */ public boolean isJobNonConcurrent(Connection conn, JobKey jobKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_JOB_NONCONCURRENT)); ps.setString(1, jobKey.getName()); ps.setString(2, jobKey.getGroup()); rs = ps.executeQuery(); if (!rs.next()) { return false; } return getBoolean(rs, COL_IS_NONCONCURRENT); } finally { closeResultSet(rs); closeStatement(ps); } }
/** * <p> * Check whether or not the given job is stateful. * </p> * * @param conn * the DB Connection * @return true if the job exists and is stateful, false otherwise */ public boolean isJobNonConcurrent(Connection conn, JobKey jobKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(rtp(SELECT_JOB_NONCONCURRENT)); ps.setString(1, jobKey.getName()); ps.setString(2, jobKey.getGroup()); rs = ps.executeQuery(); if (!rs.next()) { return false; } return getBoolean(rs, COL_IS_NONCONCURRENT); } finally { closeResultSet(rs); closeStatement(ps); } }