@Test public void testSetPreparedStatementValue() throws Exception { ValueMetaTimestamp vm = new ValueMetaTimestamp(); PreparedStatement ps = mock( PreparedStatement.class ); doAnswer( new Answer<Object>() { @Override public Object answer( InvocationOnMock invocationOnMock ) throws Throwable { Object ts = invocationOnMock.getArguments()[1]; return ts.toString(); } } ).when( ps ).setTimestamp( anyInt(), (Timestamp) anyObject() ); try { vm.setPreparedStatementValue( mock( DatabaseMeta.class ), ps, 0, null ); } catch ( KettleDatabaseException ex ) { fail( "Check PDI-11547" ); } }
@Override public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data ) throws KettleDatabaseException { try { if ( data != null ) { preparedStatement.setTimestamp( index, getTimestamp( data ) ); } else { preparedStatement.setNull( index, java.sql.Types.TIMESTAMP ); } } catch ( Exception e ) { throw new KettleDatabaseException( toStringMeta() + " : Unable to set value on prepared statement on index " + index, e ); } }
ValueMetaTimestamp extends ValueMetaDate { @Override public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data ) throws KettleDatabaseException { try { if ( data != null ) { preparedStatement.setTimestamp( index, getTimestamp( data ) ); } else { preparedStatement.setNull( index, java.sql.Types.TIMESTAMP ); } } catch ( Exception e ) { throw new KettleDatabaseException( toStringMeta() + " : Unable to set value on prepared statement on index " + index, e ); } } }
ValueMetaTimestamp extends ValueMetaDate { @Override public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data ) throws KettleDatabaseException { try { if ( data != null ) { preparedStatement.setTimestamp( index, getTimestamp( data ) ); } else { preparedStatement.setNull( index, java.sql.Types.TIMESTAMP ); } } catch ( Exception e ) { throw new KettleDatabaseException( toStringMeta() + " : Unable to set value on prepared statement on index " + index, e ); } } ValueMetaTimestamp();  ValueMetaTimestamp( String name ); }
ValueMetaTimestamp extends ValueMetaDate { @Override public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data ) throws KettleDatabaseException { try { if ( data != null ) { preparedStatement.setTimestamp( index, getTimestamp( data ) ); } else { preparedStatement.setNull( index, java.sql.Types.TIMESTAMP ); } } catch ( Exception e ) { throw new KettleDatabaseException( toStringMeta() + " : Unable to set value on prepared statement on index " + index, e ); } } ValueMetaTimestamp();  ValueMetaTimestamp( String name ); @Override boolean isDate(); @Override Date getDate( Object object ); @Override Long getInteger( Object object ); @Override Double getNumber( Object object ); @Override BigDecimal getBigNumber( Object object ); @Override Boolean getBoolean( Object object ); @Override String getString( Object object ); Timestamp getTimestamp( Object object ); int compare( Object data1, Object data2 ); @Override Object convertDataFromString( String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull,
      int trim_type ); Timestamp convertDateToTimestamp( Date date ); @Override Object convertData( ValueMetaInterface meta2, Object data2 ); @Override Object cloneValueData( Object object ); @Override ValueMetaInterface getValueFromSQLType( DatabaseMeta databaseMeta, String name, ResultSetMetaData rm,
      int index, boolean ignoreLength, boolean lazyConversion ); @Override Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index ); @Override void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index,
      Object data ); @Override Object convertDataUsingConversionMetaData( Object data2 ); @Override byte[] getBinaryString( Object object ); @Override void writeData( DataOutputStream outputStream, Object object ); @Override Object readData( DataInputStream inputStream ); @Override synchronized SimpleDateFormat getDateFormat(); @Override String getFormatMask(); @Override Class<?> getNativeDataTypeClass(); }
ValueMetaTimestamp extends ValueMetaDate { @Override public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data ) throws KettleDatabaseException { try { if ( data != null ) { preparedStatement.setTimestamp( index, getTimestamp( data ) ); } else { preparedStatement.setNull( index, java.sql.Types.TIMESTAMP ); } } catch ( Exception e ) { throw new KettleDatabaseException( toStringMeta() + " : Unable to set value on prepared statement on index " + index, e ); } } ValueMetaTimestamp();  ValueMetaTimestamp( String name ); @Override boolean isDate(); @Override Date getDate( Object object ); @Override Long getInteger( Object object ); @Override Double getNumber( Object object ); @Override BigDecimal getBigNumber( Object object ); @Override Boolean getBoolean( Object object ); @Override String getString( Object object ); Timestamp getTimestamp( Object object ); int compare( Object data1, Object data2 ); @Override Object convertDataFromString( String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull,
      int trim_type ); Timestamp convertDateToTimestamp( Date date ); @Override Object convertData( ValueMetaInterface meta2, Object data2 ); @Override Object cloneValueData( Object object ); @Override ValueMetaInterface getValueFromSQLType( DatabaseMeta databaseMeta, String name, ResultSetMetaData rm,
      int index, boolean ignoreLength, boolean lazyConversion ); @Override Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index ); @Override void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index,
      Object data ); @Override Object convertDataUsingConversionMetaData( Object data2 ); @Override byte[] getBinaryString( Object object ); @Override void writeData( DataOutputStream outputStream, Object object ); @Override Object readData( DataInputStream inputStream ); @Override synchronized SimpleDateFormat getDateFormat(); @Override String getFormatMask(); @Override Class<?> getNativeDataTypeClass();  }