dateType.setEditor(new Editor.DateEditor());
Type[] types = new Type[]{stringType, dateType, refType, singleRefType};
database.setTypes(types);
Table person = new Table("PERSON"); // XXX want case sensitivity?
Column personId = new Column("id", stringType);
person.add(personId);
person.add(new Column("sex", singleRefType));
person.add(new Column("owner", stringType));
person.add(new Column("category", refType));
person.add(new Column("category2", refType));
person.add(new Column("county", suggestType));
schema.add(person);
{
Table log = new Table("Log");
log.add(new Column("id", stringType));
log.add(new Column("date", dateType));
Column pc = new Column("parent", stringType);
ConstraintReferential fk = new ConstraintReferential("parentfk",
log);
fk.setRefTable(person);
fk.setColumns(new Column[] {pc });
fk.setRefColumns(new Column[] {personId });
log.add(fk);
log.add(pc);
schema.add(log);
}
{
Table order = new Table("Order");
order.add(new Column("date", dateType));
Column pc = new Column("parent", stringType);
ConstraintReferential fk = new ConstraintReferential("orderparentfk",
order);
fk.setRefTable(person);
fk.setColumns(new Column[] {pc });
fk.setRefColumns(new Column[] {personId });