Exemplo n.º 1
0
 public void CheckDelete(int arg1, int arg2, SymBinaryTableUpdater target)
 {
     if (source.Contains(arg1) && !target.Contains(arg1))
     {
         throw ForeignKeyViolation(arg1, arg2);
     }
     if (source.Contains(arg2) && !target.Contains(arg2))
     {
         throw ForeignKeyViolation(arg2, arg1);
     }
 }
Exemplo n.º 2
0
 public void CheckDelete(int arg1, int arg2, int arg3, Sym12TernaryTableUpdater updater)
 {
     if (source.Contains(arg1) && !target.contains_1_2(arg1))
     {
         throw ForeignKeyViolation(arg1, arg2, arg3);
     }
     if (source.Contains(arg2) && !target.contains_1_2(arg2))
     {
         throw ForeignKeyViolation(arg2, arg1, arg3);
     }
 }
Exemplo n.º 3
0
 public void MightHaveBeenDeleted(int arg1, int arg2, int arg3)
 {
     if (source.Contains(arg3) && !target.Contains3(arg3))
     {
         throw ForeignKeyViolation(arg1, arg2, arg3);
     }
 }
Exemplo n.º 4
0
 public void MightHaveBeenDeleted(int arg1, int arg2, int arg3)
 {
     if (source.Contains(arg2) && !target.Contains2(arg2))
     {
         throw ToTernaryForeingKeyViolation2(arg1, arg2, arg3);
     }
 }
Exemplo n.º 5
0
 public void WasDeleted(int surr)
 {
     if (source.Contains(surr))
     {
         throw ForeignKeyViolation(surr);
     }
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        private void CheckTargetClear()
        {
            Debug.Assert(target.WasCleared());

            if (source.clear)
            {
                return;
            }

            UnaryTable.Iter it = source.table.GetIter();
            while (!it.Done())
            {
                int elt = it.Get();
                if (source.Contains(elt) && !target.Contains1(elt))
                {
                    throw DeletionForeignKeyViolationException(elt, target.AnyDeletedArg2(elt));
                }
                it.Next();
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }