Пример #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
 /// <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);
     }
 }
Пример #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
        public void Update(IRow row, BitArray valueFlags)
        {
            RemoteRow localRow = new RemoteRow();

            _plan._process.EnsureOverflowReleased(row);
            localRow.Header         = new RemoteRowHeader();
            localRow.Header.Columns = new string[row.DataType.Columns.Count];
            for (int index = 0; index < row.DataType.Columns.Count; index++)
            {
                localRow.Header.Columns[index] = row.DataType.Columns[index].Name;
            }
            localRow.Body      = new RemoteRowBody();
            localRow.Body.Data = row.AsPhysical;
            if (BufferActive())
            {
                SyncSource(true);
            }
            _cursor.Update(localRow, valueFlags, _plan._process.GetProcessCallInfo());
            _flagsCached = false;
            _plan._programStatisticsCached = false;
            if (BufferActive())
            {
                ClearBuffer();
            }
            SetBufferDirection(BufferDirection.Backward);
        }
Пример #5
0
 public RemoteGotoData Refresh(RemoteRow row, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginRefresh(CursorHandle, callInfo, row, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndRefresh(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Пример #6
0
 public void Update(RemoteRow row, System.Collections.BitArray valueFlags, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginUpdate(CursorHandle, callInfo, row, valueFlags, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndUpdate(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Пример #7
0
        public void FindNearest(IRow key)
        {
            if (BufferActive())
            {
                ClearBuffer();
            }
            SetBufferDirection(BufferDirection.Backward);
            _plan._process.EnsureOverflowConsistent(key);
            RemoteRow localKey = new RemoteRow();

            localKey.Header         = new RemoteRowHeader();
            localKey.Header.Columns = new string[key.DataType.Columns.Count];
            for (int index = 0; index < key.DataType.Columns.Count; index++)
            {
                localKey.Header.Columns[index] = key.DataType.Columns[index].Name;
            }
            localKey.Body      = new RemoteRowBody();
            localKey.Body.Data = key.AsPhysical;
            SetFlags(_cursor.FindNearest(localKey, _plan._process.GetProcessCallInfo()));
            _plan._programStatisticsCached = false;
        }
Пример #8
0
        public IRow GetKey()
        {
            if (BufferActive())
            {
                SyncSource(true);
            }
            RemoteRow key = _cursor.GetKey(_plan._process.GetProcessCallInfo());

            _plan._programStatisticsCached = false;
            Row row;

            Schema.RowType type = new Schema.RowType();
            foreach (string stringValue in key.Header.Columns)
            {
                type.Columns.Add(((Schema.TableType)_plan.DataType).Columns[stringValue].Copy());
            }
            row             = new Row(_plan._process.ValueManager, type);
            row.ValuesOwned = false;
            row.AsPhysical  = key.Body.Data;
            return(row);
        }
Пример #9
0
 /// <returns> A <see cref="RemoteRow"/> structure containing the key for current row. </returns>
 public RemoteRow GetKey(ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         IRow      key = _serverCursor.GetKey();
         RemoteRow row = new RemoteRow();
         row.Header         = new RemoteRowHeader();
         row.Header.Columns = new string[key.DataType.Columns.Count];
         for (int index = 0; index < key.DataType.Columns.Count; index++)
         {
             row.Header.Columns[index] = key.DataType.Columns[index].Name;
         }
         row.Body      = new RemoteRowBody();
         row.Body.Data = key.AsPhysical;
         return(row);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
Пример #10
0
        public bool Refresh(IRow row)
        {
            if (BufferActive())
            {
                ClearBuffer();
            }
            SetBufferDirection(BufferDirection.Backward);
            RemoteRow localRow = new RemoteRow();

            _plan._process.EnsureOverflowConsistent(row);
            localRow.Header         = new RemoteRowHeader();
            localRow.Header.Columns = new string[row.DataType.Columns.Count];
            for (int index = 0; index < row.DataType.Columns.Count; index++)
            {
                localRow.Header.Columns[index] = row.DataType.Columns[index].Name;
            }
            localRow.Body      = new RemoteRowBody();
            localRow.Body.Data = row.AsPhysical;
            RemoteGotoData gotoData = _cursor.Refresh(localRow, _plan._process.GetProcessCallInfo());

            SetFlags(gotoData.Flags);
            _plan._programStatisticsCached = false;
            return(gotoData.Success);
        }