Bug #11873 Invalid timestamp in query produces incorrect reader exception

Submitted: 12 Jul 2005 4:00 Modified: 12 Jul 2005 21:28
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.4 OS:Windows (XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[12 Jul 2005 4:00] [ name withheld ]
Description:
If you try to ExecuteReader on a query with an malformed timestamp you receive this exception:

System.InvalidOperationException: Connection must be valid and open
   at MySql.Data.MySqlClient.MySqlCommand.CheckState()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
   at MySql.Data.MySqlClient.Driver.ShowWarnings(Int32 count)
   at MySql.Data.MySqlClient.NativeDriver.ReadEOF(Boolean readPacket)
   at MySql.Data.MySqlClient.NativeDriver.OpenDataRow(Int32 fieldCount, Boolean isBinary)
   at MySql.Data.MySqlClient.CommandResult.Load()
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
   at Builder.Service.ServiceTimer_Elapsed(Object sender, ElapsedEventArgs e) in 

How to repeat:
Create a table with a timestamp column. 

Create a connection and command.

As part of the command's SELECT, include a WHERE clause with 
a timestamp formatted like "7/1/2005 12:00:00 AM"

Creating a reader by calling command.ExecuteReader.  This will throw the exception in the description.

(yup, at first I was using the tostring value of a timestamp column as part of a query in another table; I've fixed it by correcting the query, but thought you should know that it causes this)
[12 Jul 2005 11:31] Vasily Kishkin
Tested on Win 2000 Sp4, Microsoft Visual C# .NET , Connector .NET 1.0.4 Test case is attached.
[12 Jul 2005 11:31] Vasily Kishkin
Test case

Attachment: 11873.zip (application/x-zip-compressed, text), 3.85 KiB.

[12 Jul 2005 21:28] Reggie Burnett
This bug is already fixed in our source code repository.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.