/** * This method queries the database to get the Invoice Number associated with the passes Invid * * @exception SQLException, if query fails * @author */ public long getInvID(String inv_no) { String query; long invID = 0; Statement stmt = null; ResultSet rs = null; query = "select inv_id from inv where inv_no=" + inv_no; try { stmt = conn.createStatement(); rs = stmt.executeQuery(query); if (rs.next()) { invID = rs.getLong(1); } if (rs != null) rs.close(); if (stmt != null) stmt.close(); } catch (SQLException ex) { USFEnv.getLog().writeCrit("Dinvview: The Invoice ID not retreived", this, ex); try { if (rs != null) rs.close(); if (stmt != null) stmt.close(); } catch (SQLException e) { USFEnv.getLog().writeCrit("Unable to close the resultset/statement", this, e); } } return (invID); }
protected SDMSObject rowToObject(SystemEnvironment env, ResultSet r) throws SDMSException { Long id; Long smeId; Long trId; Long nextTriggerTime; Integer timesChecked; Integer timesTriggered; Long creatorUId; Long createTs; Long changerUId; Long changeTs; long validFrom; long validTo; try { id = new Long(r.getLong(1)); smeId = new Long(r.getLong(2)); trId = new Long(r.getLong(3)); nextTriggerTime = new Long(r.getLong(4)); timesChecked = new Integer(r.getInt(5)); timesTriggered = new Integer(r.getInt(6)); creatorUId = new Long(r.getLong(7)); createTs = new Long(r.getLong(8)); changerUId = new Long(r.getLong(9)); changeTs = new Long(r.getLong(10)); validFrom = 0; validTo = Long.MAX_VALUE; } catch (SQLException sqle) { SDMSThread.doTrace(null, "SQL Error : " + sqle.getMessage(), SDMSThread.SEVERITY_ERROR); throw new FatalException( new SDMSMessage( env, "01110182045", "TriggerQueue: $1 $2", new Integer(sqle.getErrorCode()), sqle.getMessage())); } if (validTo < env.lowestActiveVersion) return null; return new SDMSTriggerQueueGeneric( id, smeId, trId, nextTriggerTime, timesChecked, timesTriggered, creatorUId, createTs, changerUId, changeTs, validFrom, validTo); }
protected SDMSObject rowToObject(SystemEnvironment env, ResultSet r) throws SDMSException { Long id; String name; Long deleteVersion; Long creatorUId; Long createTs; Long changerUId; Long changeTs; long validFrom; long validTo; try { id = new Long(r.getLong(1)); name = r.getString(2); deleteVersion = new Long(r.getLong(3)); creatorUId = new Long(r.getLong(4)); createTs = new Long(r.getLong(5)); changerUId = new Long(r.getLong(6)); changeTs = new Long(r.getLong(7)); validFrom = 0; validTo = Long.MAX_VALUE; } catch (SQLException sqle) { SDMSThread.doTrace(null, "SQL Error : " + sqle.getMessage(), SDMSThread.SEVERITY_ERROR); throw new FatalException( new SDMSMessage( env, "01110182045", "Group: $1 $2", new Integer(sqle.getErrorCode()), sqle.getMessage())); } if (validTo < env.lowestActiveVersion) return null; return new SDMSGroupGeneric( id, name, deleteVersion, creatorUId, createTs, changerUId, changeTs, validFrom, validTo); }
public DTOBDFault(ResultSet rs, String fldName) throws SQLException { super(rs, fldName); // set to default value if 'rs' is null this.faultCode = (rs != null) ? rs.getLong(fldName) : 0L; }