Beispiel #1
0
        ////////////////////////////////////////////////////////////////////////////

        static string PrintedObjOrFilename(Obj obj, bool addPath)
        {
            string path = addPath ? "debug" + IO.DirectorySeparator() : "";

            for (int i = 0; i < filedObjs.Count; i++)
            {
                if (filedObjs[i].IsEq(obj))
                {
                    return(string.Format("<{0}obj-{1}.txt>", path, i));
                }
            }

            if (ObjPrinter.PrintSizeFits(obj, 200))
            {
                return(obj.ToString());
            }

            int    idx       = filedObjs.Count;
            string outFnName = string.Format("debug{0}obj-{1}.txt", IO.DirectorySeparator(), idx);

            ObjPrinter.Print(obj, IO.FileDataWriter(outFnName), 100);

            filedObjs.Add(obj);

            return(string.Format("<{0}obj-{1}.txt>", path, idx));
        }
Beispiel #2
0
        //////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////

        public override string ToString()
        {
            DataWriter writer = IO.StringDataWriter();

            ObjPrinter.Print(this, writer, 90);
            return(writer.Output());
        }
Beispiel #3
0
        public static void Print(Obj obj, DataWriter writer)
        {
            // ObjPrinter printer = new ObjPrinter(writer, new HashSet<Obj>(new IdentityEqualityComparer<Obj>()));
            ObjPrinter printer = new ObjPrinter(writer, new HashSet <Obj>());

            obj.Visit(printer);
            writer.Flush();
        }
Beispiel #4
0
        public static void Print(Obj obj, DataWriter writer, int maxLineLen)
        {
            HashSet <Obj> multilineObjs = Multiliner.MultilineObjs(obj, maxLineLen);
            ObjPrinter    printer       = new ObjPrinter(writer, multilineObjs);

            obj.Visit(printer);
            writer.Flush();
        }
Beispiel #5
0
        //////////////////////////////////////////////////////////////////////////////

        public override string ToString()
        {
            DataWriter writer = IO.StringDataWriter();

            writer.Write("Foreign key violation: " + fromRelvar + type.OriginArgs() + " -> " + toRelvar + type.TargetArgs() + "\n");
            if (toTuple == null)
            {
                // The violation was caused by an insertion
                writer.Write("The failure was caused by the attempted insertion of:\n  " + fromRelvar + "(");
                for (int i = 0; i < fromTuple.Length; i++)
                {
                    if (i > 0)
                    {
                        writer.Write(", ");
                    }
                    ObjPrinter.Print(fromTuple[i], writer);
                }
                writer.Write(")\n");
            }
            else
            {
                // The violation was caused by a deletion in the target table
                writer.Write("The failure was caused by the attempted deletion of:\n  " + toRelvar + "(");
                for (int i = 0; i < toTuple.Length; i++)
                {
                    if (i > 0)
                    {
                        writer.Write(", ");
                    }
                    ObjPrinter.Print(toTuple[i], writer);
                }
                writer.Write(")\n");
                writer.Write("which was prevented by the presence of:\n  " + fromRelvar + "(");
                for (int i = 0; i < fromTuple.Length; i++)
                {
                    if (i > 0)
                    {
                        writer.Write(", ");
                    }
                    ObjPrinter.Print(fromTuple[i], writer);
                }
                writer.Write(")\n");
            }
            return(writer.Output());
        }
Beispiel #6
0
        public override string ToString()
        {
            bool       isComposite = key.Length > 1;
            DataWriter writer      = IO.StringDataWriter();

            writer.Write("Key violation: relation variable: " + relvarName + ", column");
            if (isComposite)
            {
                writer.Write("s");
            }
            writer.Write(":");
            for (int i = 0; i < key.Length; i++)
            {
                writer.Write(" ");
                writer.Write(key[i].ToString());
            }
            writer.Write(betweenNew ?
                         "\nAttempt to insert conflicting tuples:\n" :
                         "\nAttempt to insert tuple that conflicts with existing one:\n"
                         );
            writer.Write("  (");
            for (int i = 0; i < tuple1.Length; i++)
            {
                if (i > 0)
                {
                    writer.Write(", ");
                }
                ObjPrinter.Print(tuple1[i], writer);
            }
            writer.Write(")\n  (");
            for (int i = 0; i < tuple2.Length; i++)
            {
                if (i > 0)
                {
                    writer.Write(", ");
                }
                ObjPrinter.Print(tuple2[i], writer);
            }
            writer.Write(")\n");
            return(writer.Output());
        }
Beispiel #7
0
        public static void PrintNoFlush(Obj obj, DataWriter writer)
        {
            ObjPrinter printer = new ObjPrinter(writer, new HashSet <Obj>());

            obj.Visit(printer);
        }