* @param userId user id
* @return script object
*/
public static Script getScript(Connection con, Long scriptId, Long userId) {
Script script = null;
try {
PreparedStatement stmt = con.prepareStatement("select * from scripts where id=? and user_id=?");
stmt.setLong(1, scriptId);
stmt.setLong(2, userId);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
script = new Script();
script.setId(rs.getLong("id"));
script.setDisplayNm(rs.getString("display_nm"));
script.setScript(rs.getString("script"));
}
DBUtils.closeRs(rs);
DBUtils.closeStmt(stmt);
} catch (Exception e) {