public TimestampParameter(final long timestamp) {
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
byteRepresentation = String.valueOf("'" + sdf.format(new Date(timestamp)) + "'").getBytes();
}
public TimestampParameter(final long timestamp, final Calendar cal) {
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
sdf.setCalendar(cal);
byteRepresentation = String.valueOf("'" + sdf.format(new Date(timestamp)) + "'").getBytes();
}
org.drizzle.jdbc.internal.mysql.MySQLValueObject:
@Override
public Time getTime() throws ParseException {
if (getBytes() == null) {
return null;
}
final String rawValue = getString();
final SimpleDateFormat sdf;
if (rawValue.length() > 8) {
sdf = new SimpleDateFormat("HH:mm:ss.SSS");
} else {
sdf = new SimpleDateFormat("HH:mm:ss");
}
final java.util.Date utilTime = sdf.parse(rawValue);
return new Time(utilTime.getTime());
}
drizzle-jdbc drops fractions within timestamps of a MySql database. The tables were created to support fractional seconds.
We changed the listed methods as stated below. It worked for us, but we tested it only against MySQL Server (not Drizzle Server):
org.drizzle.jdbc.internal.common.AbstractValueObject:
org.drizzle.jdbc.internal.common.query.parameters.TimeParameter:
org.drizzle.jdbc.internal.common.query.parameters.TimestampParameter:
org.drizzle.jdbc.internal.mysql.MySQLValueObject: