Exemple #1
0
        public void Check()
        {
            // Checking that every new entry satisfies the foreign key
            int count = source.insertCount;

            if (count > 0)
            {
                int[] idxs = source.insertIdxs;
                for (int i = 0; i < count; i++)
                {
                    if (!target.Contains(idxs[i]))
                    {
                        throw ForeignKeyViolation(idxs[i], source.insertValues[i]);
                    }
                }
            }

            count = source.updateCount;
            if (count > 0)
            {
                int[] idxs = source.updateIdxs;
                for (int i = 0; i < count; i++)
                {
                    if (!target.Contains(idxs[i]))
                    {
                        throw ForeignKeyViolation(idxs[i], source.insertValues[i]);
                    }
                }
            }

            // Checking that no entries were invalidated by a deletion on the target table
            target.CheckDeletedKeys(this);
        }
        public void Check()
        {
            int count = source.insertCount;

            if (count > 0)
            {
                int[] inserts = source.insertList;
                for (int i = 0; i < count; i++)
                {
                    if (!target.Contains(inserts[i]))
                    {
                        throw ForeignKeyViolation(inserts[i]);
                    }
                }
            }

            target.CheckDeletedKeys(this);
        }
        public void Check()
        {
            if (source.HasInsertions())
            {
                long[] buffer = source.Insertions(this.buffer, counter);
                int    count  = counter[0];
                for (int i = 0; i < count; i++)
                {
                    long entry = buffer[i];
                    int  arg1  = BinaryTableUpdater.Arg1(entry);
                    if (!target.Contains(arg1))
                    {
                        throw InsertionForeignKeyViolation(arg1, BinaryTableUpdater.Arg2(entry));
                    }
                }
            }

            target.CheckDeletedKeys(this);
        }
        public void Check()
        {
            // Checking that every new entry satisfies the foreign key
            int count = source.insertCount;

            if (count > 0)
            {
                int[] inserts = source.insertList;
                for (int i = 0; i < count; i++)
                {
                    if (!target.Contains(inserts[3 * i]) | !target.Contains(inserts[3 * i + 1]))
                    {
                        throw ForeignKeyViolation(inserts[3 * i], inserts[3 * i + 1], inserts[3 * i + 2]);
                    }
                }
            }

            // Checking that no entries were invalidates by a deletion on the target table
            target.CheckDeletedKeys(this);
        }
        public void Check()
        {
            // Checking that every new entry satisfies the foreign key
            int count = source.insertCount;

            if (count == 0)
            {
                int[] inserts = source.insertList;
                for (int i = 0; i < 2 * count; i++)
                {
                    if (!target.Contains(inserts[i]))
                    {
                        int surr1 = i % 2 == 0 ? inserts[i] : inserts[i - 1];
                        int surr2 = i % 2 == 0 ? inserts[i + 1] : inserts[i];
                        throw ForeignKeyViolation(surr1, surr2);
                    }
                }
            }

            // Checking that no entries were invalidated by a deletion on the target table
            target.CheckDeletedKeys(this);
        }