예제 #1
0
        private void AddUniqueConstraintOn(Tokenizer tokenizer, Channel channel, string name, Table table)
        {
            int[] col = ProcessColumnList(tokenizer, table);

            CreateIndex(channel, table, col, name, true);
            table.AddConstraint(new Constraint(ConstraintType.Unique, table, col));
        }
예제 #2
0
        private void AddForeignKeyOn(Tokenizer tokenizer, Channel channel, string name, Table table)
        {
            int[] col = ProcessColumnList(tokenizer, table);

            tokenizer.GetThis("REFERENCES");

            Table t2 = GetTable(tokenizer.GetString(), channel);

            int[] col2 = ProcessColumnList(tokenizer, t2);

            if (table.GetIndexForColumns(col) == null)
            {
                CreateIndex(channel, table, col, "SYSTEM_FOREIGN_KEY_" + name, false);
            }

            if (t2.GetIndexForColumns(col2) == null)
            {
                CreateIndex(channel, t2, col2, "SYSTEM_REFERENCE_" + name, false);
            }

            table.AddConstraint(new Constraint(ConstraintType.ForeignKey, t2, table, col2, col));
            t2.AddConstraint(new Constraint(ConstraintType.Main, t2, table, col2, col));
        }
예제 #3
0
        private void AddUniqueConstraintOn(Tokenizer tokenizer, Channel channel, string name, Table table)
        {
            int[] col = ProcessColumnList(tokenizer, table);

            CreateIndex(channel, table, col, name, true);
            table.AddConstraint(new Constraint(ConstraintType.Unique, table, col));
        }
예제 #4
0
        private void AddForeignKeyOn(Tokenizer tokenizer, Channel channel, string name, Table table)
        {
            int[] col = ProcessColumnList(tokenizer, table);

            tokenizer.GetThis("REFERENCES");

            Table t2 = GetTable(tokenizer.GetString(), channel);
            int[]   col2 = ProcessColumnList(tokenizer, t2);

            if (table.GetIndexForColumns(col) == null)
            {
                CreateIndex(channel, table, col, "SYSTEM_FOREIGN_KEY_" + name, false);
            }

            if (t2.GetIndexForColumns(col2) == null)
            {
                CreateIndex(channel, t2, col2, "SYSTEM_REFERENCE_" + name, false);
            }

            table.AddConstraint(new Constraint(ConstraintType.ForeignKey, t2, table, col2,	col));
            t2.AddConstraint(new Constraint(ConstraintType.Main, t2, table, col2, col));
        }