Пример #1
0
 public LocalExpressionPlan(LocalProcess process, IRemoteServerExpressionPlan plan, PlanDescriptor planDescriptor, DataParams paramsValue) : base(process, plan, planDescriptor)
 {
     _plan         = plan;
     _params       = paramsValue;
     _internalPlan = new Plan(_process._internalProcess);
     GetDataType();
 }
Пример #2
0
 // OpenCursor
 public IRemoteServerCursor OpenCursor
 (
     string expression,
     ref RemoteParamData paramsValue,
     out IRemoteServerExpressionPlan plan,
     out PlanDescriptor planDescriptor,
     out ProgramStatistics executeTime,
     ProcessCallInfo callInfo,
     RemoteProcessCleanupInfo cleanupInfo,
     out Guid[] bookmarks,
     int count,
     out RemoteFetchData fetchData
 )
 {
     ProcessCallInfo(callInfo);
     plan = PrepareExpression(expression, paramsValue.Params, null, out planDescriptor, cleanupInfo);
     try
     {
         IRemoteServerCursor cursor = plan.Open(ref paramsValue, out executeTime, EmptyCallInfo());
         fetchData = cursor.Fetch(out bookmarks, count, true, EmptyCallInfo());
         return(cursor);
     }
     catch
     {
         UnprepareExpression(plan);
         plan = null;
         throw;
     }
 }
Пример #3
0
        public IServerExpressionPlan PrepareExpression(DataParams paramsValue)
        {
                        #if LOGCACHEEVENTS
            FScript.FProcess.FSession.FServer.FInternalServer.LogMessage(String.Format("Thread {0} preparing batched expression '{1}'.", Thread.CurrentThread.GetHashCode(), GetText()));
                        #endif

            PlanDescriptor planDescriptor;
            IRemoteServerExpressionPlan plan = _batch.PrepareExpression(((LocalProcess)ServerProcess).DataParamsToRemoteParams(paramsValue), out planDescriptor);
            return(new LocalExpressionPlan(_script._process, plan, planDescriptor, paramsValue));
        }
Пример #4
0
        /// <summary> Prepares the given expression for selection. </summary>
        /// <param name='expression'> A single valid Dataphor expression to prepare. </param>
        /// <returns> An <see cref="IServerExpressionPlan"/> instance for the prepared expression. </returns>
        public IServerExpressionPlan PrepareExpression(string expression, DataParams paramsValue, DebugLocator locator)
        {
                        #if LOGCACHEEVENTS
            FSession.FServer.FInternalServer.LogMessage(String.Format("Thread {0} preparing expression '{1}'.", Thread.CurrentThread.GetHashCode(), AExpression));
                        #endif

            PlanDescriptor planDescriptor;
            IRemoteServerExpressionPlan plan = _process.PrepareExpression(expression, DataParamsToRemoteParams(paramsValue), locator, out planDescriptor, GetProcessCleanupInfo());
            return(new LocalExpressionPlan(this, plan, planDescriptor, paramsValue));
        }
Пример #5
0
 public void UnprepareExpression(IRemoteServerExpressionPlan plan)
 {
     try
     {
         _serverProcess.UnprepareExpression(((RemoteServerExpressionPlan)plan).ServerExpressionPlan);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
Пример #6
0
        // CloseCursor
        public void CloseCursor(IRemoteServerCursor cursor, ProcessCallInfo callInfo)
        {
            IRemoteServerExpressionPlan plan = cursor.Plan;

            try
            {
                plan.Close(cursor, callInfo);
            }
            finally
            {
                UnprepareExpression(plan);
            }
        }
Пример #7
0
 public void Execute(ref RemoteParamData paramsValue, ProcessCallInfo callInfo)
 {
     _script.Process.ProcessCallInfo(callInfo);
     try
     {
         RemoteParam[] localParamsValue = new RemoteParam[paramsValue.Params == null ? 0 : paramsValue.Params.Length];
         for (int index = 0; index < (paramsValue.Params == null ? 0 : paramsValue.Params.Length); index++)
         {
             localParamsValue[index].Name     = paramsValue.Params[index].Name;
             localParamsValue[index].TypeName = paramsValue.Params[index].TypeName;
             localParamsValue[index].Modifier = paramsValue.Params[index].Modifier;
         }
         if (IsExpression())
         {
             PlanDescriptor planDescriptor;
             IRemoteServerExpressionPlan plan = PrepareExpression(localParamsValue, out planDescriptor);
             try
             {
                 ProgramStatistics programStatistics;
                 plan.Close(plan.Open(ref paramsValue, out programStatistics, _script.Process.EmptyCallInfo()), _script.Process.EmptyCallInfo());
                 // TODO: Provide a mechanism for determining whether or not an expression should be evaluated or opened through the remoting CLI.
             }
             finally
             {
                 UnprepareExpression(plan);
             }
         }
         else
         {
             PlanDescriptor             planDescriptor;
             IRemoteServerStatementPlan plan = PrepareStatement(localParamsValue, out planDescriptor);
             try
             {
                 ProgramStatistics programStatistics;
                 plan.Execute(ref paramsValue, out programStatistics, callInfo);
             }
             finally
             {
                 UnprepareStatement(plan);
             }
         }
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
Пример #8
0
 public void UnprepareExpression(IRemoteServerExpressionPlan plan)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginUnprepareExpression(((ClientPlan)plan).PlanHandle, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndUnprepareExpression(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Пример #9
0
 // OpenCursor
 public IRemoteServerCursor OpenCursor
 (
     string expression,
     ref RemoteParamData paramsValue,
     out IRemoteServerExpressionPlan plan,
     out PlanDescriptor planDescriptor,
     out ProgramStatistics executeTime,
     ProcessCallInfo callInfo,
     RemoteProcessCleanupInfo cleanupInfo
 )
 {
     ProcessCallInfo(callInfo);
     plan = PrepareExpression(expression, paramsValue.Params, null, out planDescriptor, cleanupInfo);
     try
     {
         return(plan.Open(ref paramsValue, out executeTime, EmptyCallInfo()));
     }
     catch
     {
         UnprepareExpression(plan);
         plan = null;
         throw;
     }
 }
Пример #10
0
 public byte[] Evaluate(string expression, ref RemoteParamData paramsValue, out IRemoteServerExpressionPlan plan, out PlanDescriptor planDescriptor, out ProgramStatistics executeTime, ProcessCallInfo callInfo, RemoteProcessCleanupInfo cleanupInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginEvaluateExpression(ProcessHandle, GetCleanupInfo(cleanupInfo), callInfo, expression, paramsValue, null, null);
         result.AsyncWaitHandle.WaitOne();
         DirectEvaluateResult evaluateResult = channel.EndEvaluateExpression(result);
         paramsValue.Data = evaluateResult.ParamData;
         planDescriptor   = evaluateResult.PlanDescriptor;
         executeTime      = evaluateResult.ExecuteTime;
         plan             = new ClientExpressionPlan(this, planDescriptor);
         return(evaluateResult.Result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Пример #11
0
 public LocalExpressionPlan(LocalProcess process, IRemoteServerExpressionPlan plan, PlanDescriptor planDescriptor, DataParams paramsValue, ProgramStatistics executeTime) : this(process, plan, planDescriptor, paramsValue)
 {
     _programStatistics       = executeTime;
     _programStatisticsCached = true;
 }
Пример #12
0
 public IRemoteServerCursor OpenCursor(string expression, ref RemoteParamData paramsValue, out IRemoteServerExpressionPlan plan, out PlanDescriptor planDescriptor, out ProgramStatistics executeTime, ProcessCallInfo callInfo, RemoteProcessCleanupInfo cleanupInfo, out Guid[] bookmarks, int count, out RemoteFetchData fetchData)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginOpenCursorWithFetch(ProcessHandle, GetCleanupInfo(cleanupInfo), callInfo, expression, paramsValue, count, null, null);
         result.AsyncWaitHandle.WaitOne();
         DirectCursorWithFetchResult cursorResult = channel.EndOpenCursorWithFetch(result);
         paramsValue.Data = cursorResult.ParamData;
         planDescriptor   = cursorResult.PlanDescriptor;
         executeTime      = cursorResult.ExecuteTime;
         bookmarks        = cursorResult.Bookmarks;
         fetchData        = cursorResult.FetchData;
         plan             = new ClientExpressionPlan(this, planDescriptor);
         return(new ClientCursor((ClientExpressionPlan)plan, cursorResult.CursorDescriptor));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Пример #13
0
 public void UnprepareExpression(IRemoteServerExpressionPlan plan)
 {
     _script.Process.UnprepareExpression(plan);
 }
Пример #14
0
 public void UnprepareExpression(IRemoteServerExpressionPlan plan)
 {
     Unprepare(plan);
 }