/** * Oracle固有の{@literal DATE}型に変換して返します。 * * @param value * 値 * @return Oracle固有の{@literal DATE}型 */ protected DATE toOracleDate(final Object value) { return new DATE(toTimestamp(value)); }
@Test public void shouldReturnContentsOfDateIfAllOkay() throws SQLException { DATE dt = mock(DATE.class); when(dt.timestampValue()).thenReturn(new Timestamp(0l)); assertEquals(new Timestamp(0l), new OracleDateNormaliser().transform(dt)); }
protected Object fromOracleTimeClasses(Column column, Object data) { try { if (data instanceof TIMESTAMP) { data = ((TIMESTAMP) data).timestampValue(); } else if (data instanceof DATE) { data = ((DATE) data).timestampValue(); } else if (data instanceof TIMESTAMPTZ) { final TIMESTAMPTZ ts = (TIMESTAMPTZ)data; data = ZonedDateTime.ofInstant(ts.timestampValue(connection.connection()).toInstant(), ts.getTimeZone().toZoneId()); } else if (data instanceof TIMESTAMPLTZ) { // JDBC driver throws an exception // final TIMESTAMPLTZ ts = (TIMESTAMPLTZ)data; // data = ts.offsetDateTimeValue(connection.connection()); return null; } } catch (SQLException e) { throw new RuntimeException("Couldn't convert value for column " + column.name(), e); } return data; }
/** * Oracle固有の{@literal DATE}型に変換して返します。 * * @param value * 値 * @return Oracle固有の{@literal DATE}型 */ protected DATE toOracleDate(final Object value) { return new DATE(toTimestamp(value)); }
@Override public void processLCR(LCR lcr) throws StreamsException { long scn = convertPositionToScn(lcr.getPosition()); // After a restart it may happen we get the event with the last processed SCN again if (scn <= offsetContext.getScn()) { LOGGER.debug("Ignoring change event with already processed SCN {}", scn); return; } offsetContext.setScn(scn); offsetContext.setTransactionId(lcr.getTransactionId()); offsetContext.setSourceTime(lcr.getSourceTime().timestampValue().toInstant()); try { if(lcr instanceof RowLCR) { dispatchDataChangeEvent((RowLCR) lcr); } else if (lcr instanceof DDLLCR) { dispatchSchemaChangeEvent((DDLLCR) lcr); } } // nothing to be done here if interrupted; the event loop will be stopped in the streaming source catch (InterruptedException e) { Thread.interrupted(); LOGGER.info("Received signal to stop, event loop will halt"); } // XStream's receiveLCRCallback() doesn't reliably propagate exceptions, so we do that ourselves here catch (Exception e) { errorHandler.setProducerThrowable(e); } }
/** * Oracle固有の{@literal DATE}型に変換して返します。 * * @param value * 値 * @return Oracle固有の{@literal DATE}型 */ protected DATE toOracleDate(final Object value) { return new DATE(toTimestamp(value)); }
/** * Oracle固有の{@literal DATE}型に変換して返します。 * * @param value * 値 * @return Oracle固有の{@literal DATE}型 */ protected DATE toOracleDate(final Object value) { return new DATE(toTimestamp(value)); }
st.setObject(index, new DATE(value));