[CONJ-713] After getTimestamp with 0000-00-00 00:00:00 all other values return NULL Created: 2019-06-11  Updated: 2021-11-17  Resolved: 2019-07-30

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 2.1.0, 2.4.0
Fix Version/s: N/A

Type: Bug Priority: Blocker
Reporter: sfahren Assignee: Diego Dupin
Resolution: Cannot Reproduce Votes: 0
Labels: timestamp, wasNull
Environment:

MariaDB 10.4/10.2; Windows


Attachments: Java Source File WasNullTest.java    

 Description   

Hello,
there is a bug with ResultSet.wasNull after getting a timestamp column with the value '0000-00-00 00:00:00'.
All subsequent calls to ResultSet.wasNull will always return true.
This is a problem because we can't check if a ResultSet.getInt that returns 0 has the database value 0 or NULL.

In the attechment is a small use case test.



 Comments   
Comment by Diego Dupin [ 2019-06-11 ]

I've run WasNullTest.java file with different driver version without error. I must miss the point here. You will tell !

Having resultset.wasNull to return null when having '0000-00-00 00:00:00' is deliberate. This has a specific behavior in the connector, since it cannot be represented in java.sql.Timestamp (min year is 1970). It is considered as null, but getString on a '0000-00-00 00:00:00' value will still return '0000-00-00 00:00:00' value.

I don't understand why you speak about ResultSet.getInt(). Is is on this timestamp field or on a field after this one ?

Comment by Diego Dupin [ 2019-07-24 ]

fahrenholz any thought on how to reproduce?

Comment by Diego Dupin [ 2019-07-30 ]

closing since not reproduced and no response

Generated at Thu Feb 08 03:17:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.