for (int year = 0; year < TPCEConstants.dailyMarketYears; year++) {
cal.set(Calendar.YEAR, TPCEConstants.dailyMarketBaseYear + year);
for (int month = 0; month < 12; month++) {
cal.set(Calendar.MONTH, month);
TimestampType t = new TimestampType(cal.getTime());
voltQueueSQL(updateDailyMarket, vol_incr, symbol, t);
}
}
// EXCHANGE
} else if (table_name.equals("EXCHANGE")) {
// Other than the table_name, no additional
// parameters are used when the table_name is EXCHANGE.
// There are only four rows in the EXCHANGE table. Every
// row will have its EX_DESC updated. If EX_DESC does not
// already end with "LAST UPDATED " and a date and time,
// that string will be appended to EX_DESC. Otherwise the
// date and time at the end of EX_DESC will be updated
// to the current date and time.
// PAVLO (2010-06-15)
// The substring replacement functions from the spec isn't
// supported, so we are just going
// to pull down all the exchange descriptions and update one at a
// time
voltQueueSQL(selectExchange);
VoltTable[] results = voltExecuteSQL();
final TimestampType now = new TimestampType();
final String last_updated = " LAST UPDATED ";
while (results[0].advanceRow()) {
long ex_id = results[0].getLong(0);
String ex_desc = results[0].getString(1);
// Update the Last Update timestamp
if (ex_desc.contains(last_updated)) {
int start_idx = ex_desc.indexOf(last_updated) + last_updated.length();
ex_desc = ex_desc.substring(0, start_idx) + now;
// Add the Last Updated string + timestamp
} else {
ex_desc += last_updated + now;
}
voltQueueSQL(updateExchange, ex_desc, ex_id);
} // WHILE
// FINANCIAL
} else if (table_name.equals("FINANCIAL")) {
// Update the FINANCIAL table for a company identified by
// co_id. That company's FI_QTR_START_DATEs will be
// updated to the second of the month or to the first of
// the month if the dates were already the second of the
// month.
// PAVLO (2010-06-15)
// Again, the date substring tricks in the spec aren't supported, so
// we'll pull
// down the data and make the decision on what to do here
voltQueueSQL(selectFinancial, co_id);
VoltTable[] results = voltExecuteSQL();
assert (results[0].advanceRow());
TimestampType orig_start_timestamp = results[0].getTimestampAsTimestamp(0);
Date qtr_start_date = orig_start_timestamp.asApproximateJavaDate();
Calendar c = Calendar.getInstance();
c.setTime(qtr_start_date);
int qtr_start_day = c.get(Calendar.DAY_OF_MONTH);
long delta = DAY_MICROSECONDS;
// Decrement by one day
if (qtr_start_day != 1)
delta *= -1;
TimestampType new_start_date = new TimestampType(orig_start_timestamp.getTime() + delta);
voltQueueSQL(updateFinancial, new_start_date, co_id);
// NEWS_ITEM
} else if (table_name.equals("NEWS_ITEM")) {
// Update the news items for a specified company.
// Change the NI_DTS by 1 day.
voltQueueSQL(selectNewsXref, co_id);
VoltTable[] results = voltExecuteSQL();
while (results[0].advanceRow()) {
long ni_id = results[0].getLong(0);
TimestampType ni_dts = results[0].getTimestampAsTimestamp(1);
voltQueueSQL(updateNewsItem, ni_dts.getTime() + DAY_MICROSECONDS, ni_id);
} // WHILE
// SECURITY
} else if (table_name.equals("SECURITY")) {
// Update a security identified symbol, increment
// S_EXCH_DATE by 1 day.
voltQueueSQL(selectSecurity, symbol);
VoltTable[] results = voltExecuteSQL();
assert (results[0].advanceRow());
TimestampType exch_date = results[0].getTimestampAsTimestamp(0);
assert (exch_date != null);
exch_date = new TimestampType(exch_date.getTime() + DAY_MICROSECONDS);
voltQueueSQL(updateSecurity, exch_date, symbol);
// TAXRATE
} else if (table_name.equals("TAXRATE")) {