Java Code Examples for java.sql.ResultSet.getLong()

The following are Jave code examples for showing how to use getLong() of the java.sql.ResultSet class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: aceql-http   File: PostgreSqlUtil.java   View Source Code Vote up 7 votes
/**
    * Extract the Large Object Input Stream from PostgreSQL
    * 
    * @param resultSet
    *            the Result Set to extract the blob from
    * @param columnIndex
    *            the index of column
    * @return the Large Object Input Stream from PostgreSQL
    * @throws SQLException
    */
   public static InputStream getPostgreSqlnputStream(ResultSet resultSet,
    int columnIndex) throws SQLException {
InputStream in;
Statement statement = resultSet.getStatement();
Connection conn = statement.getConnection();

// Get the Large Object Manager to perform operations with
LargeObjectManager lobj = ((org.postgresql.PGConnection) conn)
	.getLargeObjectAPI();
long oid = resultSet.getLong(columnIndex);

if (oid < 1) {
    return null;
}

LargeObject obj = lobj.open(oid, LargeObjectManager.READ);

in = obj.getInputStream();
return in;
   }
 
Example 2
Project: mybatisx   File: DefaultSqlRunner.java   View Source Code Vote up 7 votes
/**
 * 得到结果集总数
 * @param ps
 * @return
 * @throws SQLException
 */
private long getTotal(PreparedStatement ps) throws SQLException {
 long total=-1;
 ResultSet rs=null;
 ResultSetMetaData rsmd=null;
 String columnName=null;
 
 while(ps.getMoreResults()){
  rs= ps.getResultSet();
  	  rsmd = rs.getMetaData();
        for (int i = 0, n = rsmd.getColumnCount(); i < n; i++) {
      	  columnName=rsmd.getColumnLabel(i + 1);
      	  if(columnName.equalsIgnoreCase(COLUMN_TOTAL_NAME)){
      		  while (rs.next()) {
      			  total=rs.getLong(columnName);
    	  }
      		  break;
      	  }
        }
    }
 return total;
}
 
Example 3
Project: oscm   File: MigrateTriggers.java   View Source Code Vote up 6 votes
/**
 * Determines all triggers that are defined as suspending and processes
 * their process parameters.
 */
private void handlePendingTriggers() throws Exception {
    for (TriggerType type : TriggerType.values()) {
        PreparedStatement pstmt = conn
                .prepareStatement(QUERY_PENDING_TRIGGER_FOR_TYPE);
        pstmt.setString(1, type.name());
        ResultSet rs = pstmt.executeQuery();
        while (rs.next()) {
            long orgKey = rs.getLong("organization_tkey");
            long triggerDefinitionKey = rs.getLong("tkey");
            switch (type) {
            case ACTIVATE_SERVICE:
            case DEACTIVATE_SERVICE:
                handleServiceActivation(orgKey, triggerDefinitionKey);
                break;
            case SUBSCRIBE_TO_SERVICE:
            case UNSUBSCRIBE_FROM_SERVICE:
                handleSubscribingProcess(orgKey, triggerDefinitionKey);
                break;
            case MODIFY_SUBSCRIPTION:
            case UPGRADE_SUBSCRIPTION:
                handleSubscriptionChange(orgKey, triggerDefinitionKey);
                break;
            case SAVE_PAYMENT_CONFIGURATION:
                handleSavePayment(orgKey, triggerDefinitionKey);
                break;
            case REGISTER_CUSTOMER_FOR_SUPPLIER:
                handleCustomerRegistration(orgKey, triggerDefinitionKey);
                break;
            case ADD_REVOKE_USER:
                handleUserAssignment(orgKey, triggerDefinitionKey);
                break;
            default:
                ;
            }
        }
    }
}
 
Example 4
Project: NGB-master   File: ReferenceGenomeDao.java   View Source Code Vote up 5 votes
static Reference mapReferenceRow(ResultSet rs) throws SQLException {
    final Reference reference = new Reference();
    reference.setSize(rs.getLong(REFERENCE_GENOME_SIZE.name()));
    reference.setName(rs.getString(NAME.name()));
    reference.setPath(rs.getString(PATH.name()));
    reference.setId(rs.getLong(REFERENCE_GENOME_ID.name()));
    reference.setCreatedDate(rs.getDate(CREATED_DATE.name()));
    reference.setCreatedBy(rs.getLong(CREATED_BY.name()));
    reference.setBioDataItemId(rs.getLong(BIO_DATA_ITEM_ID.name()));
    Long longVal = rs.getLong(TYPE.name());
    reference.setType(rs.wasNull() ? null : BiologicalDataItemResourceType.getById(longVal));

    longVal = rs.getLong(GENE_ITEM_ID.name());
    if (!rs.wasNull()) {
        GeneFile geneFile = new GeneFile();
        geneFile.setId(longVal);
        reference.setGeneFile(geneFile);
    }

    long indexId = rs.getLong(INDEX_ID.name());
    if (!rs.wasNull()) {
        BiologicalDataItem index = new BiologicalDataItem();
        index.setId(indexId);
        index.setName(rs.getString(INDEX_NAME.name()));
        index.setType(BiologicalDataItemResourceType.getById(rs.getLong(INDEX_TYPE.name())));
        index.setPath(rs.getString(INDEX_PATH.name()));
        index.setFormat(BiologicalDataItemFormat.getById(rs.getLong(INDEX_FORMAT.name())));
        index.setCreatedBy(rs.getLong(CREATED_BY.name()));
        index.setCreatedDate(new Date(rs.getTimestamp(INDEX_CREATED_DATE.name()).getTime()));
        reference.setIndex(index);
    }

    return reference;
}
 
Example 5
Project: open-rmbt   File: Table.java   View Source Code Vote up 5 votes
protected void setValuesFromResult(final ResultSet rs) throws SQLException
{
    uid = rs.getLong("uid");
    
    for (final Field field : fields)
        field.setField(rs);
}
 
Example 6
Project: graphium   File: WayGraphViewRowMapper.java   View Source Code Vote up 5 votes
@Override
public IWayGraphView mapRow(ResultSet rs, int rowNum) throws SQLException {
	byte[] coveredAreaBytes = rs.getBytes("covered_area");
	return new WayGraphView(rs.getString("viewname"), 
							new WayGraph(rs.getLong("graph_id"), rs.getString("graph_name")), 
							rs.getString("dbviewname"),
							rs.getBoolean("waysegments_included"),
							(coveredAreaBytes == null ? null : (Polygon) bp.parse(coveredAreaBytes)), 
							rs.getInt("segments_count"), 
							rs.getInt("connections_count"),
							(Map<String, String>) rs.getObject("tags"));
}
 
Example 7
Project: burstcoin   File: AT.java   View Source Code Vote up 5 votes
private static List<AT> createATs( ResultSet rs ) throws SQLException
{
	List<AT> ats = new ArrayList<AT>();
	while ( rs.next() )
	{
		int i = 0;
		Long atId = rs.getLong( ++i );
		Long creator = rs.getLong( ++i );
		String name = rs.getString( ++i );
		String description = rs.getString( ++i );
		short version = rs.getShort( ++i );
		byte[] stateBytes = decompressState(rs.getBytes( ++i ));
		int csize = rs.getInt( ++i );
		int dsize = rs.getInt( ++i );
		int c_user_stack_bytes = rs.getInt( ++i );
		int c_call_stack_bytes = rs.getInt( ++i );
		int creationBlockHeight = rs.getInt( ++i );
		int sleepBetween = rs.getInt( ++i );
		int nextHeight = rs.getInt( ++i );
		boolean freezeWhenSameBalance = rs.getBoolean( ++i );
		long minActivationAmount = rs.getLong(++i);
		byte[] ap_code = decompressState(rs.getBytes( ++i ));

		AT at = new AT( AT_API_Helper.getByteArray( atId ) , AT_API_Helper.getByteArray( creator ) , name , description , version ,
				stateBytes , csize , dsize , c_user_stack_bytes , c_call_stack_bytes , creationBlockHeight , sleepBetween , nextHeight ,
				freezeWhenSameBalance , minActivationAmount , ap_code );
		ats.add( at );

	}
	return ats;
}
 
Example 8
Project: ramus   File: IEngineImpl.java   View Source Code Vote up 5 votes
private long getMainBranch() {
    try {
        ResultSet rs = ACTIVE_BRANCH_PS.executeQuery();
        rs.next();
        try {
            return rs.getLong(1);
        } finally {
            rs.close();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 9
Project: BibliotecaPS   File: SocketMetadata.java   View Source Code Vote up 5 votes
private static String findProcessHost(long threadId, java.sql.Statement processListStmt) throws SQLException {
    String processHost = null;
    ResultSet rs = processListStmt.executeQuery("SHOW PROCESSLIST");

    while (rs.next()) {
        long id = rs.getLong(1);

        if (threadId == id) {
            processHost = rs.getString(3);
            break;
        }
    }

    return processHost;
}
 
Example 10
Project: oscm   File: UserQuery.java   View Source Code Vote up 5 votes
@Override
protected void mapResult(ResultSet rs) throws SQLException {
    userId = rs.getString(1);
    passwordSalt = rs.getLong(2);
    passwordHash = rs.getBytes(3);
    orgKey = Long.valueOf(rs.getLong(4));
    remoteLdapActive = rs.getBoolean(5);
    realmUserId = rs.getString(6);
    status = rs.getString(7);
}
 
Example 11
Project: burstcoin   File: BlockDb.java   View Source Code Vote up 5 votes
static BlockImpl loadBlock(Connection con, ResultSet rs) throws NxtException.ValidationException {
    try {
        int version = rs.getInt("version");
        int timestamp = rs.getInt("timestamp");
        long previousBlockId = rs.getLong("previous_block_id");
        long totalAmountNQT = rs.getLong("total_amount");
        long totalFeeNQT = rs.getLong("total_fee");
        int payloadLength = rs.getInt("payload_length");
        byte[] generatorPublicKey = rs.getBytes("generator_public_key");
        byte[] previousBlockHash = rs.getBytes("previous_block_hash");
        BigInteger cumulativeDifficulty = new BigInteger(rs.getBytes("cumulative_difficulty"));
        long baseTarget = rs.getLong("base_target");
        long nextBlockId = rs.getLong("next_block_id");
        int height = rs.getInt("height");
        byte[] generationSignature = rs.getBytes("generation_signature");
        byte[] blockSignature = rs.getBytes("block_signature");
        byte[] payloadHash = rs.getBytes("payload_hash");

        long id = rs.getLong("id");
        long nonce = rs.getLong("nonce");

        byte[] blockATs = rs.getBytes("ats");
        
        return new BlockImpl(version, timestamp, previousBlockId, totalAmountNQT, totalFeeNQT, payloadLength, payloadHash,
                generatorPublicKey, generationSignature, blockSignature, previousBlockHash,
                cumulativeDifficulty, baseTarget, nextBlockId, height, id, nonce, blockATs);
    } catch (SQLException e) {
        throw new RuntimeException(e.toString(), e);
    }
}
 
Example 12
Project: improving-your-relational-database-architecture   File: SeedProductsWithBatchApplication.java   View Source Code Vote up 5 votes
private long insertOptions(PreparedStatement insert_options_stmt, ResultSet options_seq, long product_id, String name) throws SQLException {
	if (options_seq.next()) {
		final long color_option_id = options_seq.getLong(1);
		insert_options_stmt.setLong(1, color_option_id);
		insert_options_stmt.setLong(2, product_id);
		insert_options_stmt.setString(3, name);
		insert_options_stmt.addBatch();
		return color_option_id;
	} else {
		throw new IllegalStateException("Fell out of sequence.");
	}
}
 
Example 13
Project: dhus-core   File: RemoveDeletedProductBlobFields.java   View Source Code Vote up 4 votes
@Override
public void execute(Database database) throws CustomChangeException
{
   try
   {
      JdbcConnection connection = (JdbcConnection) database.getConnection();

      // count number of deleted products
      String sql_count = "SELECT COUNT(*) FROM DELETED_PRODUCTS";
      long max;
      try (PreparedStatement stmt = connection.prepareStatement(sql_count))
      {
         ResultSet result = stmt.executeQuery();
         if (!result.next())
         {
            throw new CustomChangeException("DELETED_PRODUCTS table update failed");
         }
         max = result.getLong(1);
      }
      LOGGER.info("{} deleted product(s) to update", max);

      long index = 0;
      String get_pattern = "SELECT ID, CHECKSUMS FROM DELETED_PRODUCTS LIMIT %d,%d";
      String update_pattern = "UPDATE DELETED_PRODUCTS SET CHECKSUM_ALGORITHM='%s', CHECKSUM_VALUE='%s' WHERE ID=%d";
      while (index < max)
      {
         // retrieve data
         sql_count = String.format(get_pattern, index, PAGE_SIZE);
         try (PreparedStatement get_stmt = connection.prepareStatement(sql_count))
         {
            ResultSet get_result = get_stmt.executeQuery();
            Statement batchUpdate = connection.createStatement();
            while (get_result.next())
            {
               // retrieve data
               long id = get_result.getLong("ID");
               Blob blob = get_result.getBlob("CHECKSUMS");
               byte[] data = blob.getBytes(1, (int) blob.length());
               Map<String, String> checksums = (Map<String, String>) deserialize(data);

               if (!checksums.isEmpty())
               {
                  // fill newly fill
                  Map.Entry<String, String> checksum = checksums.entrySet().iterator().next();
                  String sql_update = String.format(update_pattern, checksum.getKey(), checksum.getValue(), id);
                  batchUpdate.addBatch(sql_update);
               }
               index++;
            }
            batchUpdate.executeBatch();
            batchUpdate.close();
            LOGGER.info("RemoveDeletedProductBlobFields:retrieveChecksum: {}/{}", index, max);
         }
      }
   }
   catch (DatabaseException | SQLException | IOException | ClassNotFoundException e)
   {
      throw new CustomChangeException("DELETED_PRODUCTS table update failed", e);
   }
}
 
Example 14
Project: mot-public-api   File: VehicleResultSetExtractor.java   View Source Code Vote up 4 votes
@Override
public List<Vehicle> extractData(ResultSet rs) throws SQLException {

    List<Vehicle> vehicles = new ArrayList<>();

    Vehicle vehicle;
    List<MotTest> motTests = null;
    List<RfrAndAdvisoryItem> rfrAndAdvisoryItems = null;

    int vehicleId = 0;
    long motTestId = 0;

    try {
        while (rs.next()) {
            int currVehicleId = rs.getInt(VEHICLE_ID);
            long currMotTestId = rs.getLong(MOT_TEST_ID);
            long currMotTestRfrMapId = rs.getLong(RFR_MAP_ID);

            if (currVehicleId != vehicleId) {
                vehicleId = currVehicleId;

                vehicle = new Vehicle();
                motTests = new ArrayList<>();
                vehicle.setMotTests(motTests);

                vehicles.add(vehicle);

                vehicle.setRegistration(rs.getString(REGISTRATION));
                vehicle.setMake(rs.getString(MAKE));
                vehicle.setModel(rs.getString(MODEL));
                if (rs.getDate(FIRST_USED_DATE) != null) {
                    vehicle.setFirstUsedDate(SDF_DATE.format(rs.getTimestamp(FIRST_USED_DATE)));
                }
                vehicle.setFuelType(rs.getString(FUEL_TYPE));
                vehicle.setPrimaryColour(rs.getString(PRIMARY_COLOUR));
            }

            if (currMotTestId != motTestId) {
                motTestId = currMotTestId;

                MotTest motTest = new MotTest();
                rfrAndAdvisoryItems = new ArrayList<>();
                motTest.setRfrAndComments(rfrAndAdvisoryItems);

                motTests.add(motTest);
                
                if (rs.getDate(MOT_COMPLETED_DATE) != null) {
                    motTest.setCompletedDate(SDF_DATE_TIME.format(rs.getTimestamp(MOT_COMPLETED_DATE)));
                }
                motTest.setTestResult(rs.getString(MOT_TEST_RESULT));
                if (rs.getDate(MOT_EXPIRY_DATE) != null) {
                    motTest.setExpiryDate(SDF_DATE.format(rs.getTimestamp(MOT_EXPIRY_DATE)));
                }
                motTest.setOdometerValue(String.valueOf(rs.getInt(ODOMETER_VALUE)));
                motTest.setOdometerUnit(rs.getString(ODOMETER_UNIT));
                if (rs.getString(ODOMETER_RESULT_TYPE) != null) {
                    motTest.setOdometerResultType(ODOMETER_RESULT_TYPE_MAP.get(rs.getString(ODOMETER_RESULT_TYPE)));
                }
                motTest.setMotTestNumber(String.valueOf(rs.getBigDecimal(MOT_TEST_NUMBER)));
            }

            if (currMotTestRfrMapId != 0) {
                RfrAndAdvisoryItem rfrAndAdvisoryItem = new RfrAndAdvisoryItem();
                rfrAndAdvisoryItem.setType(rs.getString(RFR_TYPE));
                rfrAndAdvisoryItem.setText(rs.getString(RFR_TEXT));
                rfrAndAdvisoryItem.setDangerous(rs.getBoolean(RFR_DANGEROUS));
                rfrAndAdvisoryItems.add(rfrAndAdvisoryItem);
            }
        }

        return vehicles;
    } catch (Exception e) {
        throw new InternalException(e);
    }
}
 
Example 15
Project: xitk   File: DataSourceWrapper.java   View Source Code Vote up 4 votes
public long nextSeqValue(Connection conn, String sequenceName) throws DataAccessException {
    ParamUtil.requireNonBlank("sequenceName", sequenceName);
    final String sql = buildAndCacheNextSeqValueSql(sequenceName);
    boolean newConn = (conn == null);
    Connection tmpConn = (conn != null) ? conn : getConnection();
    Statement stmt = null;

    long next;
    try {
        stmt = tmpConn.createStatement();

        while (true) {
            ResultSet rs = stmt.executeQuery(sql);
            try {
                if (rs.next()) {
                    next = rs.getLong(1);
                    synchronized (lastUsedSeqValuesLock) {
                        Long lastValue = lastUsedSeqValues.get(sequenceName);
                        if (lastValue == null || next > lastValue) {
                            lastUsedSeqValues.put(sequenceName, next);
                            break;
                        }
                    }
                } else {
                    throw new DataAccessException(
                            "could not increment the sequence " + sequenceName);
                }
            } finally {
                releaseStatementAndResultSet(null, rs);
            }
        }
    } catch (SQLException ex) {
        throw translate(sql, ex);
    } finally {
        if (newConn) {
            releaseResources(stmt, null);
        } else {
            releaseStatementAndResultSet(stmt, null);
        }
    }

    LOG.debug("datasource {} NEXVALUE({}): {}", name, sequenceName, next);
    return next;
}
 
Example 16
Project: message-broker   File: MessageDaoImpl.java   View Source Code Vote up 4 votes
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING")
private void populateMessageWithMetadata(Connection connection,
                                         String idListAsString, List<Long> idList,
                                         Map<Long, Message> messageMap) throws SQLException, BrokerException {
    String metadataSql = "SELECT MESSAGE_ID, EXCHANGE_NAME, ROUTING_KEY, CONTENT_LENGTH, MESSAGE_METADATA "
            + " FROM MB_METADATA WHERE MESSAGE_ID IN (" + idListAsString + ") ORDER BY MESSAGE_ID";


    PreparedStatement selectMetadata = null;
    ResultSet metadataResultSet = null;

    try {
        selectMetadata = connection.prepareStatement(metadataSql);
        for (int i = 0; i < idList.size(); i++) {
            selectMetadata.setLong(i + 1, idList.get(i));
        }

        metadataResultSet = selectMetadata.executeQuery();
        while (metadataResultSet.next()) {
            long messageId = metadataResultSet.getLong(1);
            String exchangeName = metadataResultSet.getString(2);
            String routingKey = metadataResultSet.getString(3);
            long contentLength = metadataResultSet.getLong(4);
            byte[] bytes = metadataResultSet.getBytes(5);
            ByteBuf buffer = Unpooled.wrappedBuffer(bytes);
            try {
                Metadata metadata = new Metadata(messageId, routingKey, exchangeName, contentLength);
                metadata.setProperties(FieldTable.parse(buffer));
                metadata.setHeaders(FieldTable.parse(buffer));
                Message message = new Message(metadata);
                messageMap.put(messageId, message);
            } catch (Exception e) {
                throw new BrokerException("Error occurred while parsing metadata properties", e);
            } finally {
                buffer.release();
            }
        }
    } finally {
        close(metadataResultSet);
        close(selectMetadata);
    }
}
 
Example 17
Project: lams   File: DerbyMaxValueIncrementer.java   View Source Code Vote up 4 votes
@Override
protected synchronized long getNextKey() throws DataAccessException {
	if (this.nextValueIndex < 0 || this.nextValueIndex >= getCacheSize()) {
		/*
		* Need to use straight JDBC code because we need to make sure that the insert and select
		* are performed on the same connection (otherwise we can't be sure that last_insert_id()
		* returned the correct value)
		*/
		Connection con = DataSourceUtils.getConnection(getDataSource());
		Statement stmt = null;
		try {
			stmt = con.createStatement();
			DataSourceUtils.applyTransactionTimeout(stmt, getDataSource());
			this.valueCache = new long[getCacheSize()];
			this.nextValueIndex = 0;
			for (int i = 0; i < getCacheSize(); i++) {
				stmt.executeUpdate("insert into " + getIncrementerName() + " (" + getDummyName() + ") values(null)");
				ResultSet rs = stmt.executeQuery("select IDENTITY_VAL_LOCAL() from " + getIncrementerName());
				try {
					if (!rs.next()) {
						throw new DataAccessResourceFailureException("IDENTITY_VAL_LOCAL() failed after executing an update");
					}
					this.valueCache[i] = rs.getLong(1);
				}
				finally {
					JdbcUtils.closeResultSet(rs);
				}
			}
			long maxValue = this.valueCache[(this.valueCache.length - 1)];
			stmt.executeUpdate("delete from " + getIncrementerName() + " where " + getColumnName() + " < " + maxValue);
		}
		catch (SQLException ex) {
			throw new DataAccessResourceFailureException("Could not obtain IDENTITY value", ex);
		}
		finally {
			JdbcUtils.closeStatement(stmt);
			DataSourceUtils.releaseConnection(con, getDataSource());
		}
	}
	return this.valueCache[this.nextValueIndex++];
}
 
Example 18
Project: asura   File: StdJDBCDelegate.java   View Source Code Vote up 4 votes
/**
 * <p>
 * Select all of the triggers for jobs that are requesting recovery. The
 * returned trigger objects will have unique "recoverXXX" trigger names and
 * will be in the <code>{@link
 * org.quartz.Scheduler}.DEFAULT_RECOVERY_GROUP</code>
 * trigger group.
 * </p>
 * 
 * <p>
 * In order to preserve the ordering of the triggers, the fire time will be
 * set from the <code>COL_FIRED_TIME</code> column in the <code>TABLE_FIRED_TRIGGERS</code>
 * table. The caller is responsible for calling <code>computeFirstFireTime</code>
 * on each returned trigger. It is also up to the caller to insert the
 * returned triggers to ensure that they are fired.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @return an array of <code>{@link org.quartz.Trigger}</code> objects
 */
public Trigger[] selectTriggersForRecoveringJobs(Connection conn)
    throws SQLException, IOException, ClassNotFoundException {
    PreparedStatement ps = null;
    ResultSet rs = null;

    try {
        ps = conn
                .prepareStatement(rtp(SELECT_INSTANCES_RECOVERABLE_FIRED_TRIGGERS));
        ps.setString(1, instanceId);
        setBoolean(ps, 2, true);
        rs = ps.executeQuery();

        long dumId = System.currentTimeMillis();
        ArrayList list = new ArrayList();
        while (rs.next()) {
            String jobName = rs.getString(COL_JOB_NAME);
            String jobGroup = rs.getString(COL_JOB_GROUP);
            String trigName = rs.getString(COL_TRIGGER_NAME);
            String trigGroup = rs.getString(COL_TRIGGER_GROUP);
            long firedTime = rs.getLong(COL_FIRED_TIME);
            int priority = rs.getInt(COL_PRIORITY);
            SimpleTrigger rcvryTrig = new SimpleTrigger("recover_"
                    + instanceId + "_" + String.valueOf(dumId++),
                    Scheduler.DEFAULT_RECOVERY_GROUP, new Date(firedTime));
            rcvryTrig.setJobName(jobName);
            rcvryTrig.setJobGroup(jobGroup);
            rcvryTrig.setPriority(priority);
            rcvryTrig
                    .setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW);

            JobDataMap jd = selectTriggerJobDataMap(conn, trigName, trigGroup);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_NAME, trigName);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_GROUP, trigGroup);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS, String.valueOf(firedTime));
            rcvryTrig.setJobDataMap(jd);
            
            list.add(rcvryTrig);
        }
        Object[] oArr = list.toArray();
        Trigger[] tArr = new Trigger[oArr.length];
        System.arraycopy(oArr, 0, tArr, 0, oArr.length);
        return tArr;
    } finally {
        closeResultSet(rs);
        closeStatement(ps);
    }
}
 
Example 19
Project: burstcoin   File: DbKey.java   View Source Code Vote up 4 votes
@Override
public DbKey newKey(ResultSet rs) throws SQLException {
    return new LongKey(rs.getLong(idColumn));
}
 
Example 20
Project: jaffa-framework   File: TypeDefs.java   View Source Code Vote up 3 votes
/** Gets a parameter from the ResultSet.
 * @return the parameter.
 * @param engineType The engine type as defined in init.xml
 * @param rs The ResultSet.
 * @param columnName The name of the parameter.
 * @throws SQLException if a database access error occurs.
 * @throws IOException if any error occurs in reading the data from the database.
 */
public Object getAppObject(ResultSet rs, String columnName, String engineType) throws SQLException, IOException {
    long value = rs.getLong(columnName);
    if (rs.wasNull())
        return null;
    else
        return new Long(value);
}