/** * @param aPreparedStatement * @param aParamIndex * @param aParameter * @param aJdbcType * @throws SQLException */ @Override public void setNonNullParameter( PreparedStatement aPreparedStatement, int aParamIndex, AccelerateCalendar aParameter, JdbcType aJdbcType) throws SQLException { if (aJdbcType == JdbcType.DATE) { aPreparedStatement.setDate(aParamIndex, aParameter.getSqlDate()); } else if (aJdbcType == JdbcType.TIMESTAMP) { aPreparedStatement.setTimestamp(aParamIndex, new Timestamp(aParameter.getMilliseconds())); } else if (aJdbcType == JdbcType.VARCHAR) { aPreparedStatement.setString(aParamIndex, aParameter.toString()); } }
/** * @param aResultSet * @param aColumnIndex * @return {@link AccelerateCalendar} instance * @throws SQLException */ @Override public AccelerateCalendar getNullableResult(ResultSet aResultSet, int aColumnIndex) throws SQLException { Object result = aResultSet.getObject(aColumnIndex); if (result != null) { if (result instanceof Date) { return AccelerateCalendar.getInstance((Date) result); } if (result instanceof Timestamp) { return AccelerateCalendar.getInstance((Timestamp) result); } } return null; }