?? stdjdbcdelegate.java
字號:
try {
ps = conn
.prepareStatement(rtp(UPDATE_TRIGGER_STATE_FROM_OTHER_STATES_BEFORE_TIME));
ps.setString(1, newState);
ps.setString(2, oldState1);
ps.setString(3, oldState2);
ps.setLong(4, time);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Update all triggers in the given group to the given new state, if they
* are in one of the given old states.
* </p>
*
* @param conn
* the DB connection
* @param groupName
* the group containing the trigger
* @param newState
* the new state for the trigger
* @param oldState1
* one of the old state the trigger must be in
* @param oldState2
* one of the old state the trigger must be in
* @param oldState3
* one of the old state the trigger must be in
* @return int the number of rows updated
* @throws SQLException
*/
public int updateTriggerGroupStateFromOtherStates(Connection conn,
String groupName, String newState, String oldState1,
String oldState2, String oldState3) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn
.prepareStatement(rtp(UPDATE_TRIGGER_GROUP_STATE_FROM_STATES));
ps.setString(1, newState);
ps.setString(2, groupName);
ps.setString(3, oldState1);
ps.setString(4, oldState2);
ps.setString(5, oldState3);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Update the given trigger to the given new state, if it is in the given
* old state.
* </p>
*
* @param conn
* the DB connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @param newState
* the new state for the trigger
* @param oldState
* the old state the trigger must be in
* @return int the number of rows updated
* @throws SQLException
*/
public int updateTriggerStateFromOtherState(Connection conn,
String triggerName, String groupName, String newState,
String oldState) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(rtp(UPDATE_TRIGGER_STATE_FROM_STATE));
ps.setString(1, newState);
ps.setString(2, triggerName);
ps.setString(3, groupName);
ps.setString(4, oldState);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Update all of the triggers of the given group to the given new state, if
* they are in the given old state.
* </p>
*
* @param conn
* the DB connection
* @param groupName
* the group containing the triggers
* @param newState
* the new state for the trigger group
* @param oldState
* the old state the triggers must be in
* @return int the number of rows updated
* @throws SQLException
*/
public int updateTriggerGroupStateFromOtherState(Connection conn,
String groupName, String newState, String oldState)
throws SQLException {
PreparedStatement ps = null;
try {
ps = conn
.prepareStatement(rtp(UPDATE_TRIGGER_GROUP_STATE_FROM_STATE));
ps.setString(1, newState);
ps.setString(2, groupName);
ps.setString(3, oldState);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Update the states of all triggers associated with the given job.
* </p>
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @param state
* the new state for the triggers
* @return the number of rows updated
*/
public int updateTriggerStatesForJob(Connection conn, String jobName,
String groupName, String state) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(rtp(UPDATE_JOB_TRIGGER_STATES));
ps.setString(1, state);
ps.setString(2, jobName);
ps.setString(3, groupName);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
public int updateTriggerStatesForJobFromOtherState(Connection conn,
String jobName, String groupName, String state, String oldState)
throws SQLException {
PreparedStatement ps = null;
try {
ps = conn
.prepareStatement(rtp(UPDATE_JOB_TRIGGER_STATES_FROM_OTHER_STATE));
ps.setString(1, state);
ps.setString(2, jobName);
ps.setString(3, groupName);
ps.setString(4, oldState);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Delete all of the listeners associated with a given trigger.
* </p>
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger whose listeners will be deleted
* @param groupName
* the name of the group containing the trigger
* @return the number of rows deleted
*/
public int deleteTriggerListeners(Connection conn, String triggerName,
String groupName) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(rtp(DELETE_TRIGGER_LISTENERS));
ps.setString(1, triggerName);
ps.setString(2, groupName);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Associate a listener with the given trigger.
* </p>
*
* @param conn
* the DB Connection
* @param trigger
* the trigger
* @param listener
* the name of the listener to associate with the trigger
* @return the number of rows inserted
*/
public int insertTriggerListener(Connection conn, Trigger trigger,
String listener) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(rtp(INSERT_TRIGGER_LISTENER));
ps.setString(1, trigger.getName());
ps.setString(2, trigger.getGroup());
ps.setString(3, listener);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Select the listeners associated with a given trigger.
* </p>
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return array of <code>String</code> trigger listener names
*/
public String[] selectTriggerListeners(Connection conn, String triggerName,
String groupName) throws SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement(rtp(SELECT_TRIGGER_LISTENERS));
ps.setString(1, triggerName);
ps.setString(2, groupName);
rs = ps.executeQuery();
ArrayList list = new ArrayList();
while (rs.next()) {
list.add(rs.getString(1));
}
Object[] oArr = list.toArray();
String[] sArr = new String[oArr.length];
System.arraycopy(oArr, 0, sArr, 0, oArr.length);
return sArr;
} finally {
if (null != rs) {
try {
rs.close();
} catch (SQLException ignore) {
}
}
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Delete the simple trigger data for a trigger.
* </p>
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows deleted
*/
public int deleteSimpleTrigger(Connection conn, String triggerName,
String groupName) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(rtp(DELETE_SIMPLE_TRIGGER));
ps.setString(1, triggerName);
ps.setString(2, groupName);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Delete the cron trigger data for a trigger.
* </p>
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows deleted
*/
public int deleteCronTrigger(Connection conn, String triggerName,
String groupName) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(rtp(DELETE_CRON_TRIGGER));
ps.setString(1, triggerName);
ps.setString(2, groupName);
return ps.executeUpdate();
} finally {
if (null != ps) {
try {
ps.close();
} catch (SQLException ignore) {
}
}
}
}
/**
* <p>
* Delete the cron trigger data for a trigger.
* </p>
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows deleted
*/
public int deleteBlobTrigger(Connection conn, String triggerName,
String groupName) throws SQLException {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(rtp(DELETE_BLOB_TRIGGER));
ps.setString(1, triggerName);
ps.setString(2, groupName);
return ps.executeUpdate();
} finally
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -