コード例 #1
0
 /**
  * @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());
   }
 }
コード例 #2
0
  /**
   * @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;
  }