private RemoteProposeData InternalChange(RemoteRowBody oldRow, RemoteRowBody newRow, string column)
        {
            Row localOldRow = new Row(_plan.Process.ServerProcess.ValueManager, _serverCursor.SourceRowType);

            try
            {
                localOldRow.ValuesOwned = false;
                localOldRow.AsPhysical  = oldRow.Data;

                Row localNewRow = new Row(_plan.Process.ServerProcess.ValueManager, _serverCursor.SourceRowType);
                try
                {
                    localNewRow.ValuesOwned = false;
                    localNewRow.AsPhysical  = newRow.Data;
                    RemoteProposeData proposeData = new RemoteProposeData();
                    proposeData.Success   = _serverCursor.Change(localOldRow, localNewRow, column);
                    proposeData.Body      = new RemoteRowBody();
                    proposeData.Body.Data = localNewRow.AsPhysical;
                    return(proposeData);
                }
                finally
                {
                    localNewRow.Dispose();
                }
            }
            finally
            {
                localOldRow.Dispose();
            }
        }
Beispiel #2
0
        /// <summary>Ensures that the given row is valid.</summary>
        /// <param name='oldRow'>A <see cref="Row"/> containing the original values for the row.</param>
        /// <param name='newRow'>A <see cref="Row"/> containing the changed values for the row.</param>
        /// <param name='columnName'>The name of the column which changed in <paramref name="newRow"/>.  If empty, the change affected more than one column.</param>
        /// <returns>A boolean value indicating whether any change was made to <paramref name="newRow"/>.</returns>
        public bool Validate(IRow oldRow, IRow newRow, string columnName)
        {
            if ((_internalProcess != null) && TableVar.IsValidateCallRemotable(columnName))
            {
                IRow localOldRow = oldRow;
                if ((oldRow != null) && oldRow.HasNonNativeValues())
                {
                    localOldRow = new Row(_internalProcess.ValueManager, oldRow.DataType);
                    MarshalRow(oldRow, localOldRow);
                }

                IRow localNewRow = newRow;
                if (newRow.HasNonNativeValues())
                {
                    localNewRow = new Row(_internalProcess.ValueManager, newRow.DataType);
                    MarshalRow(newRow, localNewRow);
                }

                _plan._process._session._server.AcquireCacheLock(_plan._process, LockMode.Shared);
                try
                {
                    bool changed = TableNode.Validate(_internalProgram, localOldRow, localNewRow, null, columnName);
                    if (changed && !Object.ReferenceEquals(newRow, localNewRow))
                    {
                        MarshalRow(localNewRow, newRow);
                    }
                    return(changed);
                }
                finally
                {
                    _plan._process._session._server.ReleaseCacheLock(_plan._process, LockMode.Shared);
                }
            }
            else
            {
                RemoteRowBody oldBody = new RemoteRowBody();
                if (oldRow != null)
                {
                    _plan._process.EnsureOverflowReleased(oldRow);
                    oldBody.Data = oldRow.AsPhysical;
                }

                _plan._process.EnsureOverflowReleased(newRow);
                RemoteRowBody newBody = new RemoteRowBody();
                newBody.Data = newRow.AsPhysical;

                RemoteProposeData proposeData = _cursor.Validate(oldBody, newBody, columnName, _plan._process.GetProcessCallInfo());
                _plan._programStatisticsCached = false;

                if (proposeData.Success)
                {
                    newRow.ValuesOwned = false;                     // do not clear the overflow streams because the row is effectively owned by the server during the validate call
                    newRow.AsPhysical  = proposeData.Body.Data;
                    newRow.ValuesOwned = true;
                }
                return(proposeData.Success);
            }
        }
 /// <summary>
 /// Ensures that the given row is valid.
 /// </summary>
 /// <param name="ARow"></param>
 /// <param name="column"></param>
 public RemoteProposeData Validate(RemoteRowBody oldRow, RemoteRowBody newRow, string column, ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         return(InternalValidate(newRow, oldRow, column));
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
 // 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);
     }
 }
Beispiel #5
0
        /// <summary>Requests the default values for a new row in the cursor.</summary>
        /// <param name='row'>A <see cref="Row"/> to be filled in with default values.</param>
        /// <returns>A boolean value indicating whether any change was made to <paramref name="row"/>.</returns>
        public bool Default(IRow row, string columnName)
        {
            if ((_internalProcess != null) && TableVar.IsDefaultCallRemotable(columnName))
            {
                // create a new row based on FInternalProcess, and copy the data from
                IRow localRow = row;
                if (row.HasNonNativeValues())
                {
                    localRow = new Row(_internalProcess.ValueManager, row.DataType);
                    MarshalRow(row, localRow);
                }

                _plan._process._session._server.AcquireCacheLock(_plan._process, LockMode.Shared);
                try
                {
                    bool changed = TableNode.Default(_internalProgram, null, localRow, null, columnName);
                    if (changed && !Object.ReferenceEquals(localRow, row))
                    {
                        MarshalRow(localRow, row);
                    }
                    return(changed);
                }
                finally
                {
                    _plan._process._session._server.ReleaseCacheLock(_plan._process, LockMode.Shared);
                }
            }
            else
            {
                _plan._process.EnsureOverflowReleased(row);
                RemoteRowBody body = new RemoteRowBody();
                body.Data = row.AsPhysical;

                RemoteProposeData proposeData = _cursor.Default(body, columnName, _plan._process.GetProcessCallInfo());
                _plan._programStatisticsCached = false;

                if (proposeData.Success)
                {
                    row.ValuesOwned = false;                     // do not clear the overflow streams because the row is effectively owned by the server for the course of the default call.
                    row.AsPhysical  = proposeData.Body.Data;
                    row.ValuesOwned = true;
                }
                return(proposeData.Success);
            }
        }
Beispiel #6
0
 public RemoteProposeData Validate(RemoteRowBody oldRow, RemoteRowBody newRow, string column, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginValidate(CursorHandle, callInfo, oldRow, newRow, column, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndValidate(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
 public RemoteRowBody Select(ProcessCallInfo callInfo)
 {
     _plan.Process.ProcessCallInfo(callInfo);
     try
     {
         Row row = new Row(_plan.Process.ServerProcess.ValueManager, _serverCursor.SourceRowType);
         try
         {
             row.ValuesOwned = false;
             _serverCursor.Select(row);
             RemoteRowBody body = new RemoteRowBody();
             body.Data = row.AsPhysical;
             return(body);
         }
         finally
         {
             row.Dispose();
         }
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }