/// <include file='docs/MySqlConnection.xml' path='docs/BeginTransaction1/*'/>
        public new MySqlTransaction BeginTransaction(IsolationLevel iso)
        {
            //TODO: check note in help
            if (State != ConnectionState.Open)
            {
                throw new InvalidOperationException(ResourceStrings.ConnectionNotOpen);
            }

            // First check to see if we are in a current transaction
            if (driver.HasStatus(ServerStatusFlags.InTransaction))
            {
                throw new InvalidOperationException(ResourceStrings.NoNestedTransactions);
            }

            MySqlTransaction t = new MySqlTransaction(this, iso);

            MySqlCommand cmd = new MySqlCommand("", this);

            cmd.CommandText = "SET SESSION TRANSACTION ISOLATION LEVEL ";
            switch (iso)
            {
            case IsolationLevel.ReadCommitted:
                cmd.CommandText += "READ COMMITTED";
                break;

            case IsolationLevel.ReadUncommitted:
                cmd.CommandText += "READ UNCOMMITTED";
                break;

            case IsolationLevel.RepeatableRead:
                cmd.CommandText += "REPEATABLE READ";
                break;

            case IsolationLevel.Serializable:
                cmd.CommandText += "SERIALIZABLE";
                break;

            case IsolationLevel.Chaos:
                throw new NotSupportedException(ResourceStrings.ChaosNotSupported);

            case IsolationLevel.Snapshot:
                throw new NotSupportedException(ResourceStrings.SnapshotNotSupported);
            }

            cmd.ExecuteNonQuery();

            cmd.CommandText = "BEGIN";
            cmd.ExecuteNonQuery();

            return(t);
        }
 private bool IsOutputParameterResultSet()
 {
     if (driver.HasStatus(ServerStatusFlags.OutputParameters))
     {
         return(true);
     }
     if (fields.Length == 0)
     {
         return(false);
     }
     return(true);
 }
Example #3
0
        private bool IsOutputParameterResultSet()
        {
            if (driver.HasStatus(ServerStatusFlags.OutputParameters))
            {
                return(true);
            }

            if (fields.Length == 0)
            {
                return(false);
            }

            for (int x = 0; x < fields.Length; x++)
            {
                if (!fields[x].ColumnName.StartsWith("@" + StoredProcedure.ParameterPrefix))
                {
                    return(false);
                }
            }
            return(true);
        }