void handleSaveVisitInfo(VisitInfo visitInfo) { String sql = "INSERT INTO visit_info(name,visit_quantity,type) " + " VALUES ('" + visitInfo.getName() + "','" + visitInfo.getVisitQuantity() + "','" + visitInfo.getType() + "');"; this.getJt().execute(sql); }
public void saveVisitByYear() { SqlRowSet s = this.queryForRowSet( "SELECT year,COUNT(*) AS visit " + " FROM log_visit " + " GROUP BY year ;"); while (s.next()) { VisitInfo visitInfo = new VisitInfo(); visitInfo.setName(s.getString("year")); visitInfo.setVisitQuantity(s.getInt("visit")); visitInfo.setType("year"); handleSaveVisitInfo(visitInfo); } }