예제 #1
0
        /// <summary> Refreshes the cursor and attempts to reposition it on the given row. </summary>
        /// <param name="row"> A <see cref="RemoteRow"/> structure containing the row to be positioned on after the refresh. </param>
        /// <returns> A <see cref="RemoteGotoData"/> structure containing the result of the refresh. </returns>
        public RemoteGotoData Refresh(RemoteRow row, ProcessCallInfo callInfo)
        {
            _plan.Process.ProcessCallInfo(callInfo);
            try
            {
                Schema.RowType type = new Schema.RowType();
                for (int index = 0; index < row.Header.Columns.Length; index++)
                {
                    type.Columns.Add(_serverCursor.SourceRowType.Columns[row.Header.Columns[index]].Copy());
                }

                Row localRow = new Row(_plan.Process.ServerProcess.ValueManager, type);
                try
                {
                    localRow.ValuesOwned = false;
                    localRow.AsPhysical  = row.Body.Data;
                    RemoteGotoData gotoData = new RemoteGotoData();
                    gotoData.Success = _serverCursor.Refresh(localRow, out gotoData.Flags);
                    return(gotoData);
                }
                finally
                {
                    localRow.Dispose();
                }
            }
            catch (Exception E)
            {
                throw WrapException(E);
            }
        }
예제 #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
        /// <summary> Positions the cursor on the record most closely matching the given key. </summary>
        /// <param name="key"> A <see cref="RemoteRow"/> structure containing the key to be found. </param>
        /// <returns> A <see cref="CursorGetFlags"/> value indicating the state of the cursor after the search. </returns>
        public CursorGetFlags FindNearest(RemoteRow key, ProcessCallInfo callInfo)
        {
            _plan.Process.ProcessCallInfo(callInfo);
            try
            {
                Schema.RowType type = new Schema.RowType();
                for (int index = 0; index < key.Header.Columns.Length; index++)
                {
                    type.Columns.Add(_serverCursor.SourceRowType.Columns[key.Header.Columns[index]].Copy());
                }

                Row localKey = new Row(_plan.Process.ServerProcess.ValueManager, type);
                try
                {
                    localKey.ValuesOwned = false;
                    localKey.AsPhysical  = key.Body.Data;
                    CursorGetFlags flags;
                    _serverCursor.FindNearest(localKey, out flags);
                    return(flags);
                }
                finally
                {
                    localKey.Dispose();
                }
            }
            catch (Exception E)
            {
                throw WrapException(E);
            }
        }
예제 #4
0
 internal void ProcessCallInfo(ProcessCallInfo callInfo)
 {
     for (int index = 0; index < callInfo.TransactionList.Length; index++)
     {
         BeginTransaction(callInfo.TransactionList[index]);
     }
 }
예제 #5
0
        public void CloseCursor(IRemoteServerCursor cursor, ProcessCallInfo callInfo)
        {
            ClientExpressionPlan plan = (ClientExpressionPlan)cursor.Plan;

            plan.Close(cursor, callInfo);
            UnprepareExpression(plan);
        }
예제 #6
0
 /// <summary> Updates the current row of the cursor using the given <see cref="RemoteRow"/>. </summary>
 /// <param name="row"> A <see cref="RemoteRow"/> structure containing the Row to be updated. </param>
 public void Update(RemoteRow row, BitArray valueFlags, ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         Schema.RowType type = new Schema.RowType();
         foreach (string stringValue in row.Header.Columns)
         {
             type.Columns.Add(_serverCursor.SourceRowType.Columns[stringValue].Copy());
         }
         Row localRow = new Row(_plan.Process.ServerProcess.ValueManager, type);
         try
         {
             localRow.ValuesOwned = false;
             localRow.AsPhysical  = row.Body.Data;
             _serverCursor.Update(localRow, valueFlags);
         }
         finally
         {
             localRow.Dispose();
         }
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #7
0
 public void Execute(ref RemoteParamData paramsValue, ProcessCallInfo callInfo)
 {
     foreach (ClientBatch batch in _clientBatches)
     {
         batch.Execute(ref paramsValue, callInfo);
     }
 }
예제 #8
0
        // Execute
        public void Execute(string statement, ref RemoteParamData paramsValue, ProcessCallInfo callInfo, RemoteProcessCleanupInfo cleanupInfo)
        {
            ProcessCallInfo(callInfo);
            DataParams localParamsValue = RemoteParamsToDataParams(paramsValue.Params);

            _serverProcess.Execute(statement, localParamsValue);
            DataParamsToRemoteParamData(localParamsValue, ref paramsValue);
        }
예제 #9
0
        public void Execute(ref RemoteParamData paramsValue, ProcessCallInfo callInfo)
        {
            _process.ProcessCallInfo(callInfo);

            foreach (RemoteServerBatch batch in _batches)
            {
                batch.Execute(ref paramsValue, _process.EmptyCallInfo());
            }
        }
예제 #10
0
 // Countable
 /// <returns>An integer value indicating the number of rows in the cursor.</returns>
 public int RowCount(ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         return(_serverCursor.RowCount());
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #11
0
 /// <summary> Disposes a list of bookmarks. </summary>
 /// <remarks> Does nothing if the bookmark does not exist, or has already been disposed. </remarks>
 public void DisposeBookmarks(Guid[] bookmarks, ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         _serverCursor.DisposeBookmarks(bookmarks);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #12
0
 /// <summary> Compares the value of two bookmarks obtained from previous calls to <c>GetBookmark</c> . </summary>
 /// <param name="bookmark1"> A <see cref="RemoteRowBody"/> structure containing the data for the first bookmark to compare. </param>
 /// <param name="bookmark2"> A <see cref="RemoteRowBody"/> structure containing the data for the second bookmark to compare. </param>
 /// <returns> An integer value indicating whether the first bookmark was less than (negative), equal to (0) or greater than (positive) the second bookmark. </returns>
 public int CompareBookmarks(Guid bookmark1, Guid bookmark2, ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         return(_serverCursor.CompareBookmarks(bookmark1, bookmark2));
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #13
0
 /// <summary> Deletes the current DataBuffer from the cursor. </summary>
 public void Delete(ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         _serverCursor.Delete();
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #14
0
 /// <summary> Resets the server-side cursor, causing any data to be re-read and leaving the cursor on the BOF crack. </summary>
 /// <returns> A <see cref="CursorGetFlags"/> value indicating the state of the cursor after the reset. </returns>
 public CursorGetFlags Reset(ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         return(_serverCursor.ResetWithFlags());
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #15
0
 /// <summary> Positions the cursor on the EOF crack. </summary>
 /// <returns> A <see cref="CursorGetFlags"/> value indicating the state of the cursor after the move. </returns>
 public CursorGetFlags Last(ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         return(_serverCursor.MoveTo(false));
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #16
0
 /// <summary> Gets a bookmark for the current DataBuffer suitable for use in the <c>GotoBookmark</c> and <c>CompareBookmark</c> methods. </summary>
 /// <returns> A <see cref="RemoteRowBody"/> structure containing the data for the bookmark. </returns>
 public Guid GetBookmark(ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         return(_serverCursor.GetBookmark());
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #17
0
 // IRemoteProposable
 /// <summary>
 ///	Requests the default values for a new row in the cursor.
 /// </summary>
 /// <param name="row"></param>
 /// <param name="column"></param>
 /// <returns></returns>
 public RemoteProposeData Default(RemoteRowBody row, string column, ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         return(InternalDefault(row, column));
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #18
0
 public void LeaveApplicationTransaction(ProcessCallInfo callInfo)
 {
     ProcessCallInfo(callInfo);
     try
     {
         _serverProcess.LeaveApplicationTransaction();
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #19
0
        internal ProcessCallInfo GetProcessCallInfo()
        {
            ProcessCallInfo info =
                new ProcessCallInfo()
            {
                TransactionList = _transactionList.ToArray()
            };

            _transactionList.Clear();

            return(info);
        }
예제 #20
0
 public void RollbackApplicationTransaction(Guid iD, ProcessCallInfo callInfo)
 {
     ProcessCallInfo(callInfo);
     try
     {
         _serverProcess.RollbackApplicationTransaction(iD);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #21
0
 public void JoinApplicationTransaction(Guid iD, bool isInsert, ProcessCallInfo callInfo)
 {
     ProcessCallInfo(callInfo);
     try
     {
         _serverProcess.JoinApplicationTransaction(iD, isInsert);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #22
0
 /// <summary> Closes a remote, server-side cursor previously created using Open. </summary>
 /// <param name="cursor"> The cursor to close. </param>
 public void Close(IRemoteServerCursor cursor, ProcessCallInfo callInfo)
 {
     _process.ProcessCallInfo(callInfo);
     try
     {
         ServerExpressionPlan.Close(((RemoteServerCursor)cursor).ServerCursor);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #23
0
 public Guid BeginApplicationTransaction(bool shouldJoin, bool isInsert, ProcessCallInfo callInfo)
 {
     ProcessCallInfo(callInfo);
     try
     {
         return(_serverProcess.BeginApplicationTransaction(shouldJoin, isInsert));
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #24
0
        // CloseCursor
        public void CloseCursor(IRemoteServerCursor cursor, ProcessCallInfo callInfo)
        {
            IRemoteServerExpressionPlan plan = cursor.Plan;

            try
            {
                plan.Close(cursor, callInfo);
            }
            finally
            {
                UnprepareExpression(plan);
            }
        }
예제 #25
0
        public void Execute(ref RemoteParamData paramsValue, ProcessCallInfo callInfo)
        {
            ProgramStatistics executeTime;

            if (IsExpression())
            {
                ((IRemoteServerExpressionPlan)Prepare(paramsValue.Params)).Evaluate(ref paramsValue, out executeTime, callInfo);
            }
            else
            {
                ((IRemoteServerStatementPlan)Prepare(paramsValue.Params)).Execute(ref paramsValue, out executeTime, callInfo);
            }
        }
예제 #26
0
 /// <summary> Provides a mechanism for navigating the cursor by a specified number of rows. </summary>
 /// <param name='delta'> The number of rows to move by, with a negative value indicating backwards movement. </param>
 /// <returns> A <see cref="RemoteMoveData"/> structure containing the result of the move. </returns>
 public RemoteMoveData MoveBy(int delta, ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         RemoteMoveData moveData = new RemoteMoveData();
         moveData.Count = _serverCursor.MoveBy(delta, out moveData.Flags);
         return(moveData);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #27
0
 /// <summary> Positions the cursor on the DataBuffer denoted by the given bookmark obtained from a previous call to <c> GetBookmark </c> . </summary>
 /// <param name="bookmark"> A <see cref="RemoteRowBody"/> structure containing the data for the bookmark. </param>
 /// <returns> A <see cref="RemoteGotoData"/> structure containing the results of the goto call. </returns>
 public RemoteGotoData GotoBookmark(Guid bookmark, bool forward, ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         RemoteGotoData gotoData = new RemoteGotoData();
         gotoData.Success = _serverCursor.GotoBookmark(bookmark, forward, out gotoData.Flags);
         return(gotoData);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
예제 #28
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);
     }
 }
예제 #29
0
 public void CommitApplicationTransaction(Guid iD, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginCommitApplicationTransaction(ProcessHandle, callInfo, iD, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndCommitApplicationTransaction(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
예제 #30
0
 public Guid BeginApplicationTransaction(bool shouldJoin, bool isInsert, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginBeginApplicationTransaction(ProcessHandle, callInfo, shouldJoin, isInsert, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndBeginApplicationTransaction(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }