/** * Method declaration * * * @param c * @param channel * @param name * @param t * * @throws Exception */ private void addForeignKeyOn(Tokenizer c, Channel channel, string name, Table t) { int[] col = processColumnList(c, t); c.getThis("REFERENCES"); Table t2 = getTable(c.getstring(), channel); int[] col2 = processColumnList(c, t2); if (t.getIndexForColumns(col) == null) { createIndex(channel, t, col, "SYSTEM_FOREIGN_KEY_" + name, false); } if (t2.getIndexForColumns(col2) == null) { createIndex(channel, t2, col2, "SYSTEM_REFERENCE_" + name, false); } t.addConstraint(new Constraint(Constraint.FOREIGN_KEY, t2, t, col2, col)); t2.addConstraint(new Constraint(Constraint.MAIN, t2, t, col2, col)); }
/** * Method declaration * * * @param c * @param channel * @param name * @param t * * @throws Exception */ private void addUniqueConstraintOn(Tokenizer c, Channel channel, string name, Table t) { int[] col = processColumnList(c, t); createIndex(channel, t, col, name, true); t.addConstraint(new Constraint(Constraint.UNIQUE, t, col)); }