| Bug #18391 | Better error handling for the .NET class "MySqlCommand" needed. | ||
|---|---|---|---|
| Submitted: | 21 Mar 2006 14:19 | Modified: | 16 Oct 2006 17:33 |
| Reporter: | Ola Söderlund | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 1.0.7 for .NET 1.1 | OS: | Windows (Windows XP) |
| Assigned to: | CPU Architecture: | Any | |
[21 Mar 2006 14:19]
Ola Söderlund
[7 Apr 2006 9:19]
Tonci Grgin
Thanks for your problem report. Verified as described by reporter on NET 1.1 and 2.0 with latest source (command.cs):
public void Prepare()
{
if (connection == null)
throw new InvalidOperationException(Resources.GetString("ConnectionNotSet"));
if (connection.State != ConnectionState.Open)
throw new InvalidOperationException(Resources.GetString("ConnectionNotOpen"));
if (! connection.driver.Version.isAtLeast( 4,1,0))
return;
// strip out names from parameter markers
string psSQL = CommandText;
if (CommandType == CommandType.StoredProcedure)
{
if (storedProcedure == null)
storedProcedure = new StoredProcedure(connection);
psSQL = storedProcedure.Prepare(this);
}
from >> psSQL = PrepareCommandText(psSQL);
// ask our connection to send the prepare command
preparedStatement = connection.driver.Prepare(psSQL, (string[])parameterMap.ToArray(typeof(string)));
}
private string PrepareCommandText(string text)
{
StringBuilder newSQL = new StringBuilder();
// tokenize the sql first
ArrayList tokens = TokenizeSql(text);
parameterMap.Clear();
foreach (string token in tokens)
{
>>Exception here if ( token[0] != parameters.ParameterMarker )
newSQL.Append( token );
else
{
parameterMap.Add( token );
newSQL.Append( parameters.ParameterMarker );
}
}
return newSQL.ToString();
}
I'm leaving Severity S3 since workaround exists.
[26 Sep 2006 19:54]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/12566
[26 Sep 2006 19:55]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/12567
[26 Sep 2006 19:55]
Reggie Burnett
Fixed in 1.0.8 and 5.0.1
[16 Oct 2006 17:33]
MC Brown
A note has been added to the 5.0.1 and 1.0.8 changelogs.
