[Mono-bugs] [Bug 561827] New: Exception throw when call SqlCommnad.EndExecuteReader

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 9 05:22:29 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=561827

http://bugzilla.novell.com/show_bug.cgi?id=561827#c0


           Summary: Exception throw when call SqlCommnad.EndExecuteReader
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: bnc-blr-team-mono at forge.provo.novell.com
        ReportedBy: sergeyro at inbox.ru
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.5)
Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)

I have found an error in SqlCommand.BeginExecuteInternal which leads to an
error in 
SqlCommand.EndExecuteReader
see line with comments "original" and "must be"


internal IAsyncResult BeginExecuteInternal(CommandBehavior behavior, bool
wantResults, AsyncCallback callback, object state)
{
    IAsyncResult result = null;
    this.Connection.Tds.set_RecordsAffected(-1);
    TdsMetaParameterCollection metaParameters = this.Parameters.MetaParameters;
    if (this.preparedStatement == null)
    {
        bool flag = (behavior & CommandBehavior.SchemaOnly) >
CommandBehavior.Default;
        bool flag2 = (behavior & CommandBehavior.KeyInfo) >
CommandBehavior.Default;
        StringBuilder builder = new StringBuilder();
        StringBuilder builder2 = new StringBuilder();
        if (flag || flag2)
        {
            builder.Append("SET FMTONLY OFF;");
        }
        if (flag2)
        {
            builder.Append("SET NO_BROWSETABLE ON;");
            builder2.Append("SET NO_BROWSETABLE OFF;");
        }
        if (flag)
        {
            builder.Append("SET FMTONLY ON;");
            builder2.Append("SET FMTONLY OFF;");
        }
        switch (this.CommandType)
        {
            case CommandType.Text:
            {
                string str3 = string.Format("{0}{1};{2}", builder.ToString(),
this.CommandText, builder2.ToString());
                try
                {
                    if (wantResults)
                    {
                        return this.Connection.Tds.BeginExecuteQuery(str3,
metaParameters, callback, state);
                    }
                    result = this.Connection.Tds.BeginExecuteNonQuery(str3,
metaParameters, callback, state);
                }
                catch (TdsTimeoutException exception3)
                {
                    this.Connection.Tds.Reset();
                    throw SqlException.FromTdsInternalException(exception3);
                }
                catch (TdsInternalException exception4)
                {
                    this.Connection.Close();
                    throw SqlException.FromTdsInternalException(exception4);
                }
                return result;
            }
            case ((CommandType) 2):
            case ((CommandType) 3):
                return result;

            case CommandType.StoredProcedure:
            {
                string str = string.Empty;
                string str2 = string.Empty;
                if (flag2 || flag)
                {
                    str = builder.ToString();
                }
                if (flag2 || flag)
                {
                    str2 = builder2.ToString();
                }
                try
                {
                    this.Connection.Tds.BeginExecuteProcedure(str, str2,
this.CommandText, !wantResults, metaParameters, callback, state);
                }
                catch (TdsTimeoutException exception)
                {
                    this.Connection.Tds.Reset();
                    throw SqlException.FromTdsInternalException(exception);
                }
                catch (TdsInternalException exception2)
                {
                    this.Connection.Close();
                    throw SqlException.FromTdsInternalException(exception2);
                }
                return result;
            }
        }
        return result;
    }
    try
    {
        this.Connection.Tds.ExecPrepared(this.preparedStatement,
metaParameters, this.CommandTimeout, wantResults);
    }
    catch (TdsTimeoutException exception5)
    {
        this.Connection.Tds.Reset();
        throw SqlException.FromTdsInternalException(exception5);
    }
    catch (TdsInternalException exception6)
    {
        this.Connection.Close();
        throw SqlException.FromTdsInternalException(exception6);
    }
    return result;
}








Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list