[CONJ-333] ResultSet.getString() of PreparedStatement return NULL When TIME column value=00:00:00 Created: 2016-08-16  Updated: 2016-08-22  Resolved: 2016-08-22

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.4.6
Fix Version/s: 1.5.2

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Diego Dupin
Resolution: Fixed Votes: 1
Labels: None

Attachments: Java Source File MariaDbJdbcDriverTest.java    

 Description   

This bug is similar to CONJ-226, but this bug effects getString(), rather than getTime().

I've attached a test program similar to the JUnit test case in CONJ-226 to demonstrate the behavior. To make it work, first, you would need to perform some setup steps:

create table db1.time_test (
ID int unsigned NOT NULL,
time_test time NOT NULL,
PRIMARY KEY (ID)
) engine=InnoDB;
 
insert into db1.time_test(id, time_test) values(1, '00:00:00'), (2, '08:00:00');

Then build and execute the program:

$ javac -cp .:/home/ec2-user/mariadb-jdbc-1.4.6/jar/mariadb-java-client-1.4.6.jar MariaDbJdbcDriverTest.java
$ java -cp .:/home/ec2-user/mariadb-jdbc-1.4.6/jar/mariadb-java-client-1.4.6.jar MariaDbJdbcDriverTest

Example output:

ID: 1, Time: 00:00:00
Testing PreparedStatement with getTime()
ID: 1, Time: 00:00:00
Testing Statement with getString()
ID: 1, Time: 00:00:00
Testing PreparedStatement with getString()
ID: 1, Time: null



 Comments   
Comment by Diego Dupin [ 2016-08-22 ]

reproduced, when option useServerPrepStmts is set to true, ResultSet.getString() on a time column return NULL when value=00:00:00.

correction done in commit : https://github.com/MariaDB/mariadb-connector-j/commit/9fe880c6ed7ec27b12ba2a1a110f8084c42d69a2

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