use of com.mysql.cj.result.SqlDateValueFactory in project aws-mysql-jdbc by awslabs.
the class ResultSetRegressionTest method testBug23702040.
/**
* Tests fix for BUG#23702040 - JDBCDATEVALUEFACTORY FAILS TO PARSE SOME DATES.
*
* @throws Exception
*/
@Test
public void testBug23702040() throws Exception {
SimpleDateFormat sdf = TimeUtil.getSimpleDateFormat(null, "yyyy-MM-dd", TimeZone.getTimeZone("Europe/Bucharest"));
sdf.setLenient(false);
java.util.Date expected = sdf.parse("1994-03-27");
Date fromFactory = new SqlDateValueFactory(new DefaultPropertySet(), null, TimeZone.getTimeZone("Europe/Bucharest")).createFromDate(new InternalDate(1994, 3, 27));
assertEquals(expected.getTime(), fromFactory.getTime());
}
use of com.mysql.cj.result.SqlDateValueFactory in project aws-mysql-jdbc by awslabs.
the class ResultSetImpl method getDate.
@Override
public Date getDate(int columnIndex) throws SQLException {
checkRowPos();
checkColumnBounds(columnIndex);
return this.thisRow.getValue(columnIndex - 1, new SqlDateValueFactory(this.session.getPropertySet(), null, this.session.getServerSession().getDefaultTimeZone(), this));
}
use of com.mysql.cj.result.SqlDateValueFactory in project aws-mysql-jdbc by awslabs.
the class ResultSetImpl method getDate.
@Override
public Date getDate(int columnIndex, Calendar cal) throws SQLException {
checkRowPos();
checkColumnBounds(columnIndex);
return this.thisRow.getValue(columnIndex - 1, new SqlDateValueFactory(this.session.getPropertySet(), cal, cal != null ? cal.getTimeZone() : this.session.getServerSession().getDefaultTimeZone(), this));
}
Aggregations