示例#1
0
        public IServerCursor OpenCursor(string expression, DataParams paramsValue)
        {
                        #if LOGCACHEEVENTS
            FSession.FServer.FInternalServer.LogMessage(String.Format("Thread {0} opening cursor '{1}'.", Thread.CurrentThread.GetHashCode(), AExpression));
                        #endif

            RemoteParamData             localParamsValue = DataParamsToRemoteParamData(paramsValue);
            IRemoteServerExpressionPlan plan;
            IRemoteServerCursor         cursor;
            PlanDescriptor      descriptor;
            ProgramStatistics   executeTime;
            LocalExpressionPlan localPlan;
            LocalCursor         localCursor;

            if (ProcessInfo.FetchAtOpen && (ProcessInfo.FetchCount > 1))
            {
                Guid[]          bookmarks;
                RemoteFetchData fetchData;
                cursor = _process.OpenCursor(expression, ref localParamsValue, out plan, out descriptor, out executeTime, GetProcessCallInfo(), GetProcessCleanupInfo(), out bookmarks, ProcessInfo.FetchCount, out fetchData);
                RemoteParamDataToDataParams(paramsValue, localParamsValue);
                localPlan   = new LocalExpressionPlan(this, plan, descriptor, paramsValue, executeTime);
                localCursor = new LocalCursor(localPlan, cursor);
                localCursor.ProcessFetchData(fetchData, bookmarks, true);
            }
            else
            {
                cursor = _process.OpenCursor(expression, ref localParamsValue, out plan, out descriptor, out executeTime, GetProcessCallInfo(), GetProcessCleanupInfo());
                RemoteParamDataToDataParams(paramsValue, localParamsValue);
                localPlan   = new LocalExpressionPlan(this, plan, descriptor, paramsValue, executeTime);
                localCursor = new LocalCursor(localPlan, cursor);
            }
            return(localCursor);
        }
示例#2
0
 public LocalCursor(LocalExpressionPlan plan, IRemoteServerCursor cursor) : base()
 {
     _plan            = plan;
     _cursor          = cursor;
     _internalProcess = _plan._process._internalProcess;
     _internalProgram = new Program(_internalProcess);
     _internalProgram.Start(null);
     _buffer            = new LocalRows();
     _bookmarks         = new LocalBookmarks();
     _fetchCount        = _plan._process.ProcessInfo.FetchCount;
     _trivialBOF        = true;
     _sourceCursorIndex = -1;
 }
示例#3
0
        public IDataValue Evaluate(string expression, DataParams paramsValue)
        {
                        #if USECOLLAPSEDEVALUATECALLS
                        #if LOGCACHEEVENTS
            FSession.FServer.FInternalServer.LogMessage(String.Format("Thread {0} evaluating expression '{1}'.", Thread.CurrentThread.GetHashCode(), AExpression));
                        #endif

            RemoteParamData             localParamsValue = DataParamsToRemoteParamData(AParams);
            IRemoteServerExpressionPlan plan;
            PlanDescriptor    planDescriptor;
            ProgramStatistics executeTime;
            byte[]            result = FProcess.Evaluate(AExpression, ref localParamsValue, out plan, out planDescriptor, out executeTime, GetProcessCallInfo(), GetProcessCleanupInfo());
            RemoteParamDataToDataParams(AParams, localParamsValue);

                        #if LOGCACHEEVENTS
            FSession.FServer.FInternalServer.LogMessage(String.Format("Thread {0} expression evaluated.", Thread.CurrentThread.GetHashCode()));
                        #endif

            LocalExpressionPlan localPlan = new LocalExpressionPlan(this, plan, planDescriptor, AParams);
            try
            {
                return(result == null ? null : DataValue.FromPhysical(this.ValueManager, localPlan.DataType, result, 0));
            }
            finally
            {
                UnprepareExpression(localPlan);
            }
                        #else
            IServerExpressionPlan localPlan = PrepareExpression(expression, paramsValue);
            try
            {
                return(localPlan.Evaluate(paramsValue));
            }
            finally
            {
                UnprepareExpression(localPlan);
            }
                        #endif
        }