Revision 2380
Added by Duane Costa almost 20 years ago
src/edu/ucsb/nceas/metacat/harvesterClient/HarvestSiteSchedule.java | ||
---|---|---|
142 | 142 |
* update frequency. |
143 | 143 |
*/ |
144 | 144 |
private void dbUpdateHarvestDates() { |
145 |
Connection conn;
|
|
145 |
Connection conn;
|
|
146 | 146 |
long currentTime; // Current time in milliseconds |
147 | 147 |
Date dateNextHarvest; // Date of next harvest |
148 | 148 |
String lastHarvest; |
149 | 149 |
String nextHarvest; |
150 | 150 |
Date now = new Date(); |
151 | 151 |
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy"); |
152 |
Statement stmt;
|
|
152 |
Statement stmt;
|
|
153 | 153 |
long timeNextHarvest; |
154 | 154 |
|
155 | 155 |
conn = harvester.getConnection(); |
... | ... | |
160 | 160 |
nextHarvest = "'" + simpleDateFormat.format(dateNextHarvest) + "'"; |
161 | 161 |
lastHarvest = "'" + simpleDateFormat.format(now) + "'"; |
162 | 162 |
|
163 |
try {
|
|
164 |
stmt = conn.createStatement();
|
|
165 |
stmt.executeUpdate(
|
|
163 |
try { |
|
164 |
stmt = conn.createStatement();
|
|
165 |
stmt.executeUpdate(
|
|
166 | 166 |
"UPDATE HARVEST_SITE_SCHEDULE SET DATENEXTHARVEST = " + |
167 | 167 |
nextHarvest + |
168 | 168 |
" WHERE SITE_SCHEDULE_ID = " + |
169 | 169 |
siteScheduleID); |
170 |
stmt.executeUpdate(
|
|
170 |
stmt.executeUpdate(
|
|
171 | 171 |
"UPDATE HARVEST_SITE_SCHEDULE SET DATELASTHARVEST = " + |
172 | 172 |
lastHarvest + |
173 | 173 |
" WHERE SITE_SCHEDULE_ID = " + |
174 | 174 |
siteScheduleID); |
175 |
stmt.close();
|
|
176 |
}
|
|
175 |
stmt.close();
|
|
176 |
}
|
|
177 | 177 |
catch(SQLException e) { |
178 |
System.out.println("SQLException: " + e.getMessage());
|
|
179 |
}
|
|
178 |
System.out.println("SQLException: " + e.getMessage());
|
|
179 |
}
|
|
180 | 180 |
} |
181 | 181 |
|
182 | 182 |
|
Also available in: Unified diff
Formatting improvements.