01: package jimm.datavision.testdata.oracle;
02:
03: import jimm.datavision.testdata.Office;
04: import jimm.datavision.testdata.Job;
05: import jimm.datavision.testdata.AggregateTestData;
06: import java.util.Iterator;
07: import java.util.Calendar;
08:
09: class CreateData {
10:
11: public static void main(String[] args) {
12: System.out.println("delete from office;");
13: for (Iterator iter = Office.offices(); iter.hasNext();) {
14: Office o = (Office) iter.next();
15: System.out.println("insert into office values (" + o.id
16: + ", '" + o.name + "', '" + o.abbrev + "', '"
17: + o.fax + "', '" + o.email + "', '"
18: + (o.visible ? 'Y' : 'N') + "');");
19: }
20:
21: System.out.println("delete from jobs;");
22: for (Iterator iter = Job.jobs(); iter.hasNext();) {
23: Job j = (Job) iter.next();
24: System.out.println("insert into jobs values ("
25: + j.id
26: + ", '"
27: + j.title
28: + "', "
29: + j.fk_office_id
30: + ", '"
31: + j.company
32: + "', '"
33: + j.location
34: + "', '"
35: + j.description
36: + "', '"
37: + (j.visible ? 'Y' : 'N')
38: + "', to_date('"
39: + j.post_date.get(Calendar.YEAR)
40: + '-'
41: + (j.post_date.get(Calendar.MONTH) + 1)
42: + '-'
43: + j.post_date.get(Calendar.DATE)
44: + "','yyyy-mm-dd'), "
45: + (j.hourly_rate == null ? "NULL" : j.hourly_rate
46: .toString()) + ");");
47: }
48:
49: System.out.println("delete from aggregate_test;");
50: for (Iterator iter = AggregateTestData
51: .aggregateTestData("../aggregate_test.dat"); iter
52: .hasNext();) {
53: AggregateTestData data = (AggregateTestData) iter.next();
54: System.out.println("insert into aggregate_test values ('"
55: + data.col1() + "', '" + data.col2() + "', "
56: + data.value() + ");");
57:
58: }
59: }
60:
61: }
|