Esempio n. 1
0
        private void PrepareApplicationTransactionServer(bool isInsert)
        {
            if (!IsApplicationTransactionClient && UseApplicationTransactions && (_openState == DataSetState.Browse))
            {
                using (IRow row = RememberActive())
                {
                    if (_applicationTransactionID == Guid.Empty)
                    {
                        _applicationTransactionID = BeginApplicationTransaction(isInsert);
                    }

                    _aTCursor = new DAECursor(_process);
                    try
                    {
                        _aTCursor.OnErrors  += new CursorErrorsOccurredHandler(CursorOnErrors);
                        _aTCursor.Expression = InternalGetExpression();
                        // Copy the params, but only if they are not already pushed on the process through the FCursor
                        if ((_cursor == null) || !_cursor.ShouldOpen)
                        {
                            _aTCursor.Params.AddRange(_cursor.Params);
                        }
                        _aTCursor.Prepare();
                        try
                        {
                            SetParamValues();
                            _aTCursor.ShouldOpen = ShouldOpenCursor();
                            _aTCursor.Open();
                            try
                            {
                                if (!isInsert && (row != null))
                                {
                                    if (!_aTCursor.FindKey(row))
                                    {
                                        throw new ClientException(ClientException.Codes.RecordNotFound);
                                    }
                                }
                            }
                            catch
                            {
                                _aTCursor.Close();
                                throw;
                            }
                        }
                        catch
                        {
                            _aTCursor.Unprepare();
                            throw;
                        }
                    }
                    catch
                    {
                        _aTCursor.OnErrors -= new CursorErrorsOccurredHandler(CursorOnErrors);
                        _aTCursor.Dispose();
                        _aTCursor = null;
                        throw;
                    }
                }
            }
        }
Esempio n. 2
0
        private void StartProcess()
        {
            ProcessInfo processInfo = new ProcessInfo(_session.SessionInfo);

            processInfo.DefaultIsolationLevel = _isolationLevel;
            processInfo.FetchAtOpen           = ShouldFetchAtOpen();
            _process          = _session.ServerSession.StartProcess(processInfo);
            _cursor           = new DAECursor(_process);
            _cursor.OnErrors += new CursorErrorsOccurredHandler(CursorOnErrors);
        }
Esempio n. 3
0
        private void UnprepareApplicationTransactionServer()
        {
            Guid iD = _applicationTransactionID;

            _applicationTransactionID = Guid.Empty;
            if (_openState == DataSetState.Browse)
            {
                if (_aTCursor != null)
                {
                    _aTCursor.OnErrors -= new CursorErrorsOccurredHandler(CursorOnErrors);
                    _aTCursor.Dispose();
                    _aTCursor = null;
                }
            }
            else
            {
                CloseCursor();
            }
        }
Esempio n. 4
0
 protected void CursorOnErrors(DAECursor cursor, CompilerMessages messages)
 {
     ReportErrors(messages);
 }