Ejemplo n.º 1
0
        protected int CompareKeyValues(object keyValue1, object keyValue2, PlanNode compareNode)
        {
            Program.Stack.Push(keyValue1);
            Program.Stack.Push(keyValue2);
            int result = (int)compareNode.Execute(Program);

            Program.Stack.Pop();
            Program.Stack.Pop();
            return(result);
        }
Ejemplo n.º 2
0
        public object Execute(DataParams paramsValue)
        {
            object result;

            Start(paramsValue);
            try
            {
                long startTicks = TimingUtility.CurrentTicks;
                result = _code.Execute(this);
                _statistics.ExecuteTime = TimingUtility.TimeSpanFromTicks(startTicks);
            }
            finally
            {
                Stop(paramsValue);
            }
            return(result);
        }
Ejemplo n.º 3
0
 public string GetViolationMessage(Program program)
 {
     try
     {
         if (_violationMessageNode != null)
         {
             string message = (string)_violationMessageNode.Execute(program);
             if ((message != String.Empty) && (message[message.Length - 1] != '.'))
             {
                 message = message + '.';
             }
             return(message);
         }
         return(String.Empty);
     }
     catch (Exception exception)
     {
         return(String.Format("Errors occurred attempting to generate custom error message for constraint \"{0}\": {1}", Name, exception.Message));
     }
 }
Ejemplo n.º 4
0
        // Must be called with the original stack
        protected BrowseTableItem CreateTable(IRow origin, bool forward, bool inclusive)
        {
            // Prepare the context variable to contain the origin value (0 if this is an unanchored set)
            object contextVar;
            Row    localOrigin;

            if (origin == null)
            {
                localOrigin = null;
                contextVar  = 0;
            }
            else
            {
                if ((origin.DataType.Columns.Count > 0) && (Schema.Object.Qualifier(origin.DataType.Columns[0].Name) != Keywords.Origin))
                {
                    localOrigin = new Row(Manager, new Schema.RowType(origin.DataType.Columns, Keywords.Origin));
                }
                else
                {
                    localOrigin = new Row(Manager, new Schema.RowType(origin.DataType.Columns));
                }
                origin.CopyTo(localOrigin);
                contextVar = localOrigin;
            }

            int  originIndex    = ((localOrigin == null) ? -1 : localOrigin.DataType.Columns.Count - 1);
            bool localInclusive = (localOrigin == null) ? true : inclusive;

            // Ensure the browse node has the appropriate browse variant
            lock (Node)
            {
                if (!Node.HasBrowseVariant(originIndex, forward, localInclusive))
                {
                    Program.ServerProcess.PushGlobalContext();
                    try
                    {
                        Node.CompileBrowseVariant(Program, originIndex, forward, localInclusive);
                    }
                    finally
                    {
                        Program.ServerProcess.PopGlobalContext();
                    }
                }
            }

            // Execute the variant with the current context variable
            Program.Stack.Push(contextVar);
            try
            {
                PlanNode browseVariantNode = Node.GetBrowseVariantNode(Program.Plan, originIndex, forward, localInclusive);
                                #if TRACEBROWSEEVENTS
                Trace.WriteLine(String.Format("BrowseTableItem created with query: {0}", new D4TextEmitter().Emit(browseVariantNode.EmitStatement(EmitMode.ForCopy))));
                                #endif
                return
                    (new BrowseTableItem
                     (
                         this,
                         (ITable)browseVariantNode.Execute(Program),
                         contextVar,
                         localOrigin,
                         forward,
                         inclusive
                     ));
            }
            finally
            {
                Program.Stack.Pop();
            }
        }