[CONJ-225] limit cause `getString` from int column error. Created: 2015-11-25  Updated: 2016-01-11  Resolved: 2015-11-30

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.3.0, 1.3.2, 1.3.1
Fix Version/s: 1.3.3

Type: Bug Priority: Major
Reporter: zhanhb Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: tests

Issue Links:
Problem/Incident
causes CONJ-243 ResultSet.getString returns '1' on BO... Closed

 Description   

import java.sql.*;
import org.junit.Assert;
import org.junit.Test;

public class Main {

@Test
public void test() throws ClassNotFoundException, SQLException {
Class.forName("org.mariadb.jdbc.Driver");
try (Connection connection = DriverManager.getConnection("jdbc:mariadb://localhost/test", "root", "root")) {
try {
connection.prepareStatement("CREATE TABLE table1(column1 int)").execute();
connection.prepareStatement("INSERT INTO table1(column1) VALUES (2)").execute();
try (PreparedStatement ps = connection.prepareStatement("select column1 from table1 limit ?")) {
ps.setInt(1, 20);
ResultSet rs = ps.executeQuery();
while (rs.next())

{ Assert.assertEquals("2", rs.getString("column1")); }

}
} finally

{ connection.prepareStatement("drop table table1").execute(); }

}
}

}



 Comments   
Comment by Diego Dupin [ 2015-11-30 ]

Correction done for version 1.3.3 for the end of this week.

2 commits :
https://github.com/MariaDB/mariadb-connector-j/commit/455f36f71556bbdc11b04753f388116c72b3fca4
and https://github.com/MariaDB/mariadb-connector-j/commit/fce8e4c5bbcacca27380ee04e2151364a44aab4a

Travis result :
https://travis-ci.org/MariaDB/mariadb-connector-j/builds/93970103

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