コード例 #1
0
ファイル: MySqlConnection.cs プロジェクト: GodLesZ/svn-dump
		new public MySqlTransaction BeginTransaction( System.Data.IsolationLevel iso ) {
			if( this.State != ConnectionState.Open ) {
				throw new InvalidOperationException( Resources.ConnectionNotOpen );
			}
			if( ( this.driver.ServerStatus & ServerStatusFlags.InTransaction ) != 0 ) {
				throw new InvalidOperationException( Resources.NoNestedTransactions );
			}
			MySqlTransaction transaction = new MySqlTransaction( this, iso );
			MySqlCommand command = new MySqlCommand( "", this );
			command.CommandText = "SET SESSION TRANSACTION ISOLATION LEVEL ";
			switch( iso ) {
				case System.Data.IsolationLevel.Chaos:
					throw new NotSupportedException( Resources.ChaosNotSupported );

				case System.Data.IsolationLevel.ReadUncommitted:
					command.CommandText = command.CommandText + "READ UNCOMMITTED";
					goto Label_00F1;

				case System.Data.IsolationLevel.ReadCommitted:
					command.CommandText = command.CommandText + "READ COMMITTED";
					break;

				case System.Data.IsolationLevel.RepeatableRead:
					command.CommandText = command.CommandText + "REPEATABLE READ";
					break;

				case System.Data.IsolationLevel.Serializable:
					command.CommandText = command.CommandText + "SERIALIZABLE";
					break;
			}
Label_00F1:
			command.ExecuteNonQuery();
			command.CommandText = "BEGIN";
			command.ExecuteNonQuery();
			return transaction;
		}
コード例 #2
0
ファイル: MySqlHelper.cs プロジェクト: GodLesZ/svn-dump
 private static MySqlDataReader ExecuteReader(MySqlConnection connection, MySqlTransaction transaction, string commandText, MySqlParameter[] commandParameters, bool ExternalConn)
 {
     MySqlDataReader reader;
     MySqlCommand command = new MySqlCommand();
     command.Connection = connection;
     command.Transaction = transaction;
     command.CommandText = commandText;
     command.CommandType = CommandType.Text;
     if (commandParameters != null)
     {
         foreach (MySqlParameter parameter in commandParameters)
         {
             command.Parameters.Add(parameter);
         }
     }
     if (ExternalConn)
     {
         reader = command.ExecuteReader();
     }
     else
     {
         reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     }
     command.Parameters.Clear();
     return reader;
 }
コード例 #3
0
		void IPromotableSinglePhaseNotification.Initialize() {
			string name = Enum.GetName( typeof( System.Transactions.IsolationLevel ), this.baseTransaction.IsolationLevel );
			System.Data.IsolationLevel iso = (System.Data.IsolationLevel)Enum.Parse( typeof( System.Data.IsolationLevel ), name );
			this.simpleTransaction = this.connection.BeginTransaction( iso );
		}
コード例 #4
0
ファイル: MySqlCommand.cs プロジェクト: GodLesZ/svn-dump
		public MySqlCommand( string cmdText, MySqlConnection connection, MySqlTransaction transaction )
			: this( cmdText, connection ) {
			this.curTransaction = transaction;
		}