コード例 #1
0
        // IDbConnection.BeginTransaction, OleDbTransaction.Begin
        internal static ArgumentOutOfRangeException InvalidIsolationLevel(System.Data.IsolationLevel value)
        {
#if DEBUG
            switch (value)
            {
            case System.Data.IsolationLevel.Unspecified:
            case System.Data.IsolationLevel.Chaos:
            case System.Data.IsolationLevel.ReadUncommitted:
            case System.Data.IsolationLevel.ReadCommitted:
            case System.Data.IsolationLevel.RepeatableRead:
            case System.Data.IsolationLevel.Serializable:
            case System.Data.IsolationLevel.Snapshot:
                Debug.Fail("valid IsolationLevel " + value.ToString());
                break;
            }
#endif
            return(InvalidEnumerationValue(typeof(System.Data.IsolationLevel), (int)value));
        }
コード例 #2
0
 internal static Exception SnapshotNotSupported(System.Data.IsolationLevel level)
 {
     return(ADP.Argument(Res.GetString("SQL_SnapshotNotSupported", new object[] { typeof(System.Data.IsolationLevel), level.ToString() })));
 }
コード例 #3
0
ファイル: xSqlCeConnection.cs プロジェクト: X10sions/X10sions
        public new SqlCeTransaction BeginTransaction(System.Data.IsolationLevel isolationLevel)
        {
            int num = 0;

            if (HasDelegatedTransaction)
            {
                throw new InvalidOperationException(Res.GetString("ADP_ParallelTransactionsNotSupported", GetType().Name));
            }
            if (!isDisposed)
            {
                CheckStateOpen("BeginTransaction");
                SEISOLATION isoLevel;
                switch (isolationLevel)
                {
                case System.Data.IsolationLevel.Unspecified:
                case System.Data.IsolationLevel.ReadCommitted:
                    isoLevel = SEISOLATION.ISO_READ_COMMITTED;
                    break;

                case System.Data.IsolationLevel.RepeatableRead:
                    isoLevel = SEISOLATION.ISO_REPEATABLE_READ;
                    break;

                case System.Data.IsolationLevel.Serializable:
                    isoLevel = SEISOLATION.ISO_SERIALIZABLE;
                    break;

                default:
                    throw new ArgumentException(Res.GetString("ADP_InvalidIsolationLevel", isolationLevel.ToString()));
                }
                SqlCeTransaction sqlCeTransaction = null;
                IntPtr           ppUnknown        = IntPtr.Zero;
                IntPtr           ppUnknown2       = IntPtr.Zero;
                try {
                    num = NativeMethods.OpenTransaction(pSeStore, pQpDatabase, isoLevel, IQPSession, ref ppUnknown, ref ppUnknown2, pError);
                    if (num != 0)
                    {
                        ProcessResults(num);
                    }
                    sqlCeTransaction = new SqlCeTransaction(this, isolationLevel, ppUnknown, ppUnknown2);
                    AddWeakReference(sqlCeTransaction);
                    return(sqlCeTransaction);
                } catch (Exception) {
                    if (IntPtr.Zero != ppUnknown2)
                    {
                        NativeMethods.SafeRelease(ref ppUnknown2);
                    }
                    if (IntPtr.Zero != ppUnknown)
                    {
                        NativeMethods.SafeRelease(ref ppUnknown);
                    }
                    throw;
                }
            }
            throw new ObjectDisposedException("SqlCeConnection");
        }
コード例 #4
0
        internal override void ExecuteTransaction(SqlInternalConnection.TransactionRequest transactionRequest, string transactionName, System.Data.IsolationLevel iso, SqlInternalTransaction internalTransaction, bool isDelegateControlRequest)
        {
            if (Bid.AdvancedOn)
            {
                Bid.Trace("<sc.SqlInternalConnectionSmi.ExecuteTransaction|ADV> %d#, transactionRequest=%ls, transactionName='%ls', isolationLevel=%ls, internalTransaction=#%d transactionId=0x%I64x.\n", base.ObjectID, transactionRequest.ToString(), (transactionName != null) ? transactionName : "null", iso.ToString(), (internalTransaction != null) ? internalTransaction.ObjectID : 0, (internalTransaction != null) ? internalTransaction.TransactionId : 0L);
            }
            switch (transactionRequest)
            {
            case SqlInternalConnection.TransactionRequest.Begin:
                try
                {
                    this._pendingTransaction = internalTransaction;
                    this._smiConnection.BeginTransaction(transactionName, iso, this._smiEventSink);
                    goto Label_0121;
                }
                finally
                {
                    this._pendingTransaction = null;
                }
                break;

            case SqlInternalConnection.TransactionRequest.Promote:
                base.PromotedDTCToken = this._smiConnection.PromoteTransaction(this._currentTransaction.TransactionId, this._smiEventSink);
                goto Label_0121;

            case SqlInternalConnection.TransactionRequest.Commit:
                break;

            case SqlInternalConnection.TransactionRequest.Rollback:
            case SqlInternalConnection.TransactionRequest.IfRollback:
                this._smiConnection.RollbackTransaction(this._currentTransaction.TransactionId, transactionName, this._smiEventSink);
                goto Label_0121;

            case SqlInternalConnection.TransactionRequest.Save:
                this._smiConnection.CreateTransactionSavePoint(this._currentTransaction.TransactionId, transactionName, this._smiEventSink);
                goto Label_0121;

            default:
                goto Label_0121;
            }
            this._smiConnection.CommitTransaction(this._currentTransaction.TransactionId, this._smiEventSink);
Label_0121:
            this._smiEventSink.ProcessMessagesAndThrow();
        }