List of usage examples for java.sql ResultSet CONCUR_READ_ONLY
int CONCUR_READ_ONLY
To view the source code for java.sql ResultSet CONCUR_READ_ONLY.
Click Source Link
ResultSet
object that may NOT be updated. From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff[] readBuffByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { final String S_ProcName = "readBuffByVAccFreqIdx"; try {/* ww w . j a v a 2 s .c om*/ Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefBuff + "WHERE " + ((ViewAccessFrequencyId == null) ? "val.ViewAccessFrequencyId is null " : "val.ViewAccessFrequencyId = " + ViewAccessFrequencyId.toString() + " ") + "ORDER BY " + "anyo.Id ASC"; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); List<MSSBamAtomDefBuff> buffList = new ArrayList<MSSBamAtomDefBuff>(); while (resultSet.next()) { MSSBamAtomDefBuff buff = unpackAtomDefResultSetToBuff(resultSet); buffList.add(buff); } return (buffList.toArray(new MSSBamAtomDefBuff[0])); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff[] readBuffByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { final String S_ProcName = "readBuffByEAccSecIdx"; try {// ww w . ja va2s . co m Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefBuff + "WHERE " + ((EditAccessSecurityId == null) ? "val.EditAccessSecurityId is null " : "val.EditAccessSecurityId = " + EditAccessSecurityId.toString() + " ") + "ORDER BY " + "anyo.Id ASC"; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); List<MSSBamAtomDefBuff> buffList = new ArrayList<MSSBamAtomDefBuff>(); while (resultSet.next()) { MSSBamAtomDefBuff buff = unpackAtomDefResultSetToBuff(resultSet); buffList.add(buff); } return (buffList.toArray(new MSSBamAtomDefBuff[0])); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff[] readBuffByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { final String S_ProcName = "readBuffByEAccFreqIdx"; try {//from w w w .ja va 2 s . c om Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefBuff + "WHERE " + ((EditAccessFrequencyId == null) ? "val.EditAccessFrequencyId is null " : "val.EditAccessFrequencyId = " + EditAccessFrequencyId.toString() + " ") + "ORDER BY " + "anyo.Id ASC"; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); List<MSSBamAtomDefBuff> buffList = new ArrayList<MSSBamAtomDefBuff>(); while (resultSet.next()) { MSSBamAtomDefBuff buff = unpackAtomDefResultSetToBuff(resultSet); buffList.add(buff); } return (buffList.toArray(new MSSBamAtomDefBuff[0])); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff[] readBuffByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { final String S_ProcName = "readBuffByPrevIdx"; try {/*from www . j av a2 s. c o m*/ Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefBuff + "WHERE " + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " ") + "ORDER BY " + "anyo.Id ASC"; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); List<MSSBamAtomDefBuff> buffList = new ArrayList<MSSBamAtomDefBuff>(); while (resultSet.next()) { MSSBamAtomDefBuff buff = unpackAtomDefResultSetToBuff(resultSet); buffList.add(buff); } return (buffList.toArray(new MSSBamAtomDefBuff[0])); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff[] readBuffByNextIdx(MSSBamAuthorization Authorization, Long NextId) { final String S_ProcName = "readBuffByNextIdx"; try {/*from w w w. j a va 2s.c om*/ Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefBuff + "WHERE " + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " ") + "ORDER BY " + "anyo.Id ASC"; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); List<MSSBamAtomDefBuff> buffList = new ArrayList<MSSBamAtomDefBuff>(); while (resultSet.next()) { MSSBamAtomDefBuff buff = unpackAtomDefResultSetToBuff(resultSet); buffList.add(buff); } return (buffList.toArray(new MSSBamAtomDefBuff[0])); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff[] readBuffByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) {// ww w . j a v a 2 s. c om final String S_ProcName = "readBuffByContPrevIdx"; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefBuff + "WHERE " + "val.ValueContainerId = " + Long.toString(ValueContainerId) + " " + "AND " + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " ") + "ORDER BY " + "anyo.Id ASC"; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); List<MSSBamAtomDefBuff> buffList = new ArrayList<MSSBamAtomDefBuff>(); while (resultSet.next()) { MSSBamAtomDefBuff buff = unpackAtomDefResultSetToBuff(resultSet); buffList.add(buff); } return (buffList.toArray(new MSSBamAtomDefBuff[0])); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff[] readBuffByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long NextId) {/*from w w w. j av a 2 s .c om*/ final String S_ProcName = "readBuffByContNextIdx"; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefBuff + "WHERE " + "val.ValueContainerId = " + Long.toString(ValueContainerId) + " " + "AND " + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " ") + "ORDER BY " + "anyo.Id ASC"; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); List<MSSBamAtomDefBuff> buffList = new ArrayList<MSSBamAtomDefBuff>(); while (resultSet.next()) { MSSBamAtomDefBuff buff = unpackAtomDefResultSetToBuff(resultSet); buffList.add(buff); } return (buffList.toArray(new MSSBamAtomDefBuff[0])); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public void updateAtomDef(MSSBamAuthorization Authorization, MSSBamAtomDefBuff Buff) { final String S_ProcName = "updateAtomDef"; try {/*from w w w.j a v a 2 s . c om*/ Connection cnx = schema.getCnx(); long Id = Buff.getRequiredId(); String DbName = Buff.getOptionalDbName(); String sql = "UPDATE mssbam110.atom_def " + "SET " + "Id = " + MSSBamPg8Schema.getInt64String(Id) + ", " + "DbName = " + ((DbName != null) ? MSSBamPg8Schema.getQuotedString(DbName) : "null") + " " + "WHERE " + "Id = " + Long.toString(Id) + " "; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); int rowsAffected = stmt.executeUpdate(sql); if (rowsAffected != 1) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 row to be affected by update, not " + rowsAffected); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public void deleteAtomDef(MSSBamAuthorization Authorization, MSSBamAtomDefBuff Buff) { final String S_ProcName = "deleteAtomDef"; try {/* w w w . j av a 2 s . c o m*/ Connection cnx = schema.getCnx(); long Id = Buff.getRequiredId(); String DbName = Buff.getOptionalDbName(); String sql = "DELETE FROM mssbam110.atom_def " + "WHERE " + "Id = " + Long.toString(Id) + " "; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); int rowsAffected = stmt.executeUpdate(sql); if (rowsAffected != 1) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected 1 row to be affected by delete, not " + rowsAffected); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } }
From source file:srvmonitor.thGetAgendas.java
@Override public void run() { /*/*w w w . j a v a2s .co m*/ Recupera Parametros Fecha Actual */ logger.info("Buscando Agendas Activas"); String[] ids = TimeZone.getAvailableIDs(-4 * 60 * 60 * 1000); String clt = ids[0]; SimpleTimeZone tz = new SimpleTimeZone(-4 * 60 * 60 * 1000, clt); tz.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); tz.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); Calendar calendar = new GregorianCalendar(tz); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); // Jan = 0, dec = 11 int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR); int weekOfMonth = calendar.get(Calendar.WEEK_OF_MONTH); int hour = calendar.get(Calendar.HOUR); // 12 hour clock int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY); // 24 hour clock int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); int millisecond = calendar.get(Calendar.MILLISECOND); int findHour = 12; int findMinutes = 5; /* calendar.add(Calendar.HOUR_OF_DAY, -1); int hourBefore = calendar.get(Calendar.HOUR_OF_DAY); calendar.add(Calendar.HOUR_OF_DAY, 2); int hourAfter = calendar.get(Calendar.HOUR_OF_DAY); */ String posmonth = String.valueOf(month + 1); String posdayOfMonth = String.valueOf(dayOfMonth); String posdayOfWeek = String.valueOf(dayOfWeek); String posweekOfYear = String.valueOf(weekOfYear); String posweekOfMonth = String.valueOf(weekOfMonth); String poshourOfDay = String.valueOf(hourOfDay); String posminute = String.valueOf(minute); String possecond = String.valueOf(second); String posmillisecond = String.valueOf(millisecond); Calendar iteratorCalendar; String vSQL; String iteratorHour; String iteratorMinute; Statement stm; JSONObject jData; JSONObject jDataMinute; JSONArray jArray = new JSONArray(); JSONArray jArrayMinute = new JSONArray(); String posIteratorHour; String posIteratorMinute; /* Inicializa Lista de Agendas */ gDatos.getLstShowAgendas().clear(); gDatos.getLstActiveAgendas().clear(); for (int i = -findHour; i <= findHour; i++) { iteratorCalendar = new GregorianCalendar(tz); iteratorCalendar.add(Calendar.HOUR_OF_DAY, i); iteratorHour = String.valueOf(iteratorCalendar.get(Calendar.HOUR_OF_DAY)); posIteratorHour = String.valueOf(Integer.valueOf(iteratorHour) + 1); vSQL = "select " + iteratorHour + " horaAgenda,ageID, month, dayOfMonth, dayOfWeek, weekOfYear, weekOfMonth, hourOfDay from process.tb_agenda where " + " ageEnable=1 " + " and substr(month," + posmonth + ",1) = '1'" + " and substr(dayOfMonth," + posdayOfMonth + ",1) = '1'" + " and substr(dayOfWeek," + posdayOfWeek + ",1) = '1'" + " and substr(weekOfYear," + posweekOfYear + ",1) = '1'" + " and substr(weekOfMonth," + posweekOfMonth + ",1) = '1'" + " and substr(hourOfDay," + posIteratorHour + ",1) = '1'"; logger.debug("i: " + i + " vSQL: " + vSQL); try { stm = gDatos.getServerStatus().getMetadataConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); jData = new JSONObject(); ResultSet rs = stm.executeQuery(vSQL); if (rs != null) { while (rs.next()) { jData = new JSONObject(); jData.put("horaAgenda", rs.getString("horaAgenda")); jData.put("ageID", rs.getString("ageID")); jData.put("month", rs.getString("month")); jData.put("dayOfMonth", rs.getString("dayOfMonth")); jData.put("weekOfYear", rs.getString("weekOfYear")); jData.put("weekOfMonth", rs.getString("weekOfMonth")); jData.put("hourOfDay", rs.getString("hourOfDay")); jArray.put(jData); gDatos.getLstShowAgendas().add(jData); } } else { jData.put("horaAgenda", iteratorHour); jData.put("ageID", ""); jData.put("month", ""); jData.put("dayOfMonth", ""); jData.put("weekOfYear", ""); jData.put("weekOfMonth", ""); jData.put("hourOfDay", ""); jArray.put(jData); gDatos.getLstShowAgendas().add(jData); System.out.println("No hay registros"); } stm.close(); } catch (SQLException | JSONException e) { logger.error(e.getMessage()); } } iteratorCalendar = new GregorianCalendar(tz); iteratorHour = String.valueOf(iteratorCalendar.get(Calendar.HOUR_OF_DAY)); posIteratorHour = String.valueOf(Integer.valueOf(iteratorHour) + 1); for (int i = -findMinutes; i <= 0; i++) { iteratorCalendar = new GregorianCalendar(tz); iteratorCalendar.add(Calendar.MINUTE, i); iteratorMinute = String.valueOf(iteratorCalendar.get(Calendar.MINUTE)); posIteratorMinute = String.valueOf(Integer.valueOf(iteratorMinute) + 1); vSQL = "select " + iteratorMinute + " horaAgenda,ageID, month, dayOfMonth, dayOfWeek, weekOfYear, weekOfMonth, hourOfDay from process.tb_agenda where " + " ageEnable=1 " + " and substr(month," + posmonth + ",1) = '1'" + " and substr(dayOfMonth," + posdayOfMonth + ",1) = '1'" + " and substr(dayOfWeek," + posdayOfWeek + ",1) = '1'" + " and substr(weekOfYear," + posweekOfYear + ",1) = '1'" + " and substr(weekOfMonth," + posweekOfMonth + ",1) = '1'" + " and substr(hourOfDay," + posIteratorHour + ",1) = '1'" + " and substr(minute," + posIteratorMinute + ",1) = '1'"; logger.debug("i: " + i + " vSQL: " + vSQL); try { stm = gDatos.getServerStatus().getMetadataConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stm.executeQuery(vSQL); if (rs != null) { while (rs.next()) { jDataMinute = new JSONObject(); jDataMinute.put("horaAgenda", rs.getString("horaAgenda")); jDataMinute.put("ageID", rs.getString("ageID")); jDataMinute.put("month", rs.getString("month")); jDataMinute.put("dayOfMonth", rs.getString("dayOfMonth")); jDataMinute.put("weekOfYear", rs.getString("weekOfYear")); jDataMinute.put("weekOfMonth", rs.getString("weekOfMonth")); jDataMinute.put("hourOfDay", rs.getString("hourOfDay")); jArrayMinute.put(jDataMinute); gDatos.getLstActiveAgendas().add(jDataMinute); } } stm.close(); } catch (SQLException | JSONException e) { logger.error(e.getMessage()); } } for (int i = 0; i < gDatos.getLstShowAgendas().size(); i++) { logger.debug(gDatos.getLstShowAgendas().get(i).toString()); } for (int i = 0; i < gDatos.getLstActiveAgendas().size(); i++) { logger.debug(gDatos.getLstActiveAgendas().get(i).toString()); } logger.info("Finaliza busquenda agendas activas..."); }