コード例 #1
0
ファイル: VirtuosoCommand.cs プロジェクト: 15831944/virtuoso
 public VirtuosoCommand(string cmdText, VirtuosoConnection connection, VirtuosoTransaction transaction)
 {
     Debug.WriteLineIf(CLI.FnTrace.Enabled, "VirtuosoCommand.ctor()");
     this.commandText = cmdText;
     this.connection  = connection;
     this.transaction = transaction;
     this.parameters  = new VirtuosoParameterCollection(this);
 }
コード例 #2
0
ファイル: VirtuosoCommand.cs プロジェクト: 15831944/virtuoso
 internal void OnConnectionClose()
 {
     if (isFetching)
     {
         CloseDataReader();
     }
     DisposeStatement();
     transaction = null;
 }
コード例 #3
0
ファイル: TransactionTest.cs プロジェクト: 15831944/virtuoso
        public void RollbackNoWork(TestCaseResult result)
        {
            CheckTransactionCapable(result);

            CheckTable(result);
            VirtuosoTransaction t = connection.BeginTransaction();

            result.FailIfNotSame(connection, t.Connection);
            t.Rollback();
            CheckTable(result);
        }
コード例 #4
0
ファイル: TransactionTest.cs プロジェクト: 15831944/virtuoso
        public void Commit(TestCaseResult result)
        {
            CheckTransactionCapable(result);

            CheckTable(result);
            VirtuosoTransaction t = connection.BeginTransaction();

            InsertRow(3);
            InsertRow(4);
            CheckTable(result);
            t.Commit();
            CheckTable(result);
        }
コード例 #5
0
ファイル: TransactionTest.cs プロジェクト: 15831944/virtuoso
        public void Rollback(TestCaseResult result)
        {
            CheckTransactionCapable(result);

            CheckTable(result);
            VirtuosoTransaction t = connection.BeginTransaction();

            InsertRow(3);
            InsertRow(4);
            CheckTable(result);
            t.Rollback();
            DeleteRow(3);
            DeleteRow(4);
            CheckTable(result);
        }
コード例 #6
0
ファイル: VirtuosoCommand.cs プロジェクト: 15831944/virtuoso
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             DisposeStatement();
         }
         base.Dispose(disposing);
         if (connection != null &&
             connection.innerConnection != null)
         {
             connection.innerConnection.RemoveCommand(this);
         }
         connection  = null;
         transaction = null;
     }
     catch (Exception e)
     {
         Debug.WriteLineIf(CLI.FnTrace.Enabled,
                           "VirtuosoCommand.Dispose caught exception: " + e.Message);
     }
 }
コード例 #7
0
 internal VirtuosoTransaction CheckTransaction (VirtuosoTransaction transaction)
 {
     if (transactionStrongRef != null)
     {
         VirtuosoTransaction currentTransaction = (VirtuosoTransaction) transactionStrongRef;
         if (currentTransaction != transaction)
         {
             if (currentTransaction == null)
                 EndTransaction (false);
             if (transaction == null)
                 throw new InvalidOperationException ("The transaction is not set.");
             else
                 throw new InvalidOperationException ("The transaction is not associated with the connection.");
         }
     }
     else if (transaction != null)
     {
         if (transaction.Connection != null)
             throw new InvalidOperationException ("The transaction is not associated with the connection.");
         transaction = null;
     }
     return transaction;
 }
コード例 #8
0
        internal void EndTransaction (bool commit)
        {
            if (state == System.Data.ConnectionState.Closed)
                throw new InvalidOperationException ("The connection is closed.");
            if (autocommit)
                throw new InvalidOperationException ("No transaction is active.");

            innerConnection.EndTransaction (commit);

            transactionStrongRef = null;
            autocommit = true;
        }
コード例 #9
0
        public VirtuosoTransaction BeginTransaction (IsolationLevel level)
#endif
        {
            Debug.WriteLineIf (CLI.FnTrace.Enabled, "VirtuosoConnection.BeginTransaction (level = " + level + ")");

            if (state == ConnectionState.Closed)
                throw new InvalidOperationException ("The connection is closed");

            CLI.IsolationLevel isolation;
            switch (level)
            {
                case IsolationLevel.ReadUncommitted:
                    isolation = CLI.IsolationLevel.SQL_TXN_READ_UNCOMMITTED;
                    break;
                case IsolationLevel.ReadCommitted:
                    isolation = CLI.IsolationLevel.SQL_TXN_READ_COMMITED;
                    break;
                case IsolationLevel.RepeatableRead:
                    isolation = CLI.IsolationLevel.SQL_TXN_REPEATABLE_READ;
                    break;
                case IsolationLevel.Serializable:
                    isolation = CLI.IsolationLevel.SQL_TXN_SERIALIZABLE;
                    break;
                case IsolationLevel.Unspecified:
                    isolation = CLI.IsolationLevel.SQL_TXN_READ_COMMITED;
                    break;
                default:
                    throw new Exception ("Unknown or unsupported isolation level");
            }

            VirtuosoTransaction transaction = null;
            if (!autocommit && transactionStrongRef != null)
            {
                transaction = (VirtuosoTransaction) transactionStrongRef;
                if (transaction != null)
                    throw new InvalidOperationException ("Another transaction is running.");
                EndTransaction (false);
            }

            innerConnection.BeginTransaction (isolation);

            autocommit = false;
            transaction = new VirtuosoTransaction (this, level);
            transactionStrongRef = transaction;

            return transaction;
        }
コード例 #10
0
		public VirtuosoCommand (string cmdText, VirtuosoConnection connection, VirtuosoTransaction transaction)
		{
			Debug.WriteLineIf (CLI.FnTrace.Enabled, "VirtuosoCommand.ctor()");
			this.commandText = cmdText;
			this.connection = connection;
			this.transaction = transaction;
			this.parameters = new VirtuosoParameterCollection (this);
		}
コード例 #11
0
		internal void OnConnectionClose ()
		{
			if (isFetching)
				CloseDataReader ();
			DisposeStatement ();
			transaction = null;
		}
コード例 #12
0
		protected override void Dispose (bool disposing)
		{
			try
			{
			if (disposing)
			{
				DisposeStatement ();
			}
			base.Dispose (disposing);
			if (connection != null && 
			    connection.innerConnection != null)
				connection.innerConnection.RemoveCommand (this);
			connection = null;
			transaction = null;
		}
			catch (Exception e)
			{
				Debug.WriteLineIf(CLI.FnTrace.Enabled,
					"VirtuosoCommand.Dispose caught exception: " + e.Message);
			}
		}