Retrieves the value of a JDBC TIME parameter as a java.sql.Time object, using the given Calendar object to construct the time.
553553
@Override
    public Time getTime(String parameterName, Calendar cal) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
379790
@SuppressWarnings("deprecation")
    public static LocalTime toLocalTime(java.sql.Time sqlTime) {
        return LocalTime.of(sqlTime.getHours(), sqlTime.getMinutes(), sqlTime.getSeconds());
    }
3315
public ZonedDateTime getInternalZonedDateTime(ColumnInformation columnInfo, Class clazz,
      TimeZone timeZone) throws SQLException {
    if (lastValueWasNull()) {
      return null;
    }
    if (length == 0) {
      lastValueNull |= BIT_LAST_FIELD_NULL;
      return null;
    }

    switch (columnInfo.getColumnType().getSqlType()) {
      case Types.TIMESTAMP:

        int year = ((buf[pos] & 0xff) | (buf[pos + 1] & 0xff) << 8);
        int month = buf[pos + 2];
        int day = buf[pos + 3];
        int hour = 0;
        int minutes = 0;
        int seconds = 0;
        int microseconds = 0;

        if (length > 4) {
          hour = buf[pos + 4];
          minutes = buf[pos + 5];
          seconds = buf[pos + 6];

          if (length > 7) {
            microseconds = ((buf[pos + 7] & 0xff)
                + ((buf[pos + 8] & 0xff) << 8)
                + ((buf[pos + 9] & 0xff) << 16)
                + ((buf[pos + 10] & 0xff) << 24));
          }
        }

        return ZonedDateTime
            .of(year, month, day, hour, minutes, seconds, microseconds * 1000, timeZone.toZoneId());

      case Types.VARCHAR:
      case Types.LONGVARCHAR:
      case Types.CHAR:

        //string conversion
        String raw = new String(buf, pos, length, StandardCharsets.UTF_8);
        if (raw.startsWith("0000-00-00 00:00:00")) {
          return null;
        }
        try {
          return ZonedDateTime.parse(raw, TEXT_ZONED_DATE_TIME);
        } catch (DateTimeParseException dateParserEx) {
          throw new SQLException(raw
              + " cannot be parse as ZonedDateTime. time must have \"yyyy-MM-dd[T/ ]HH:mm:ss[.S]\" "
              + "with offset and timezone format (example : '2011-12-03 10:15:30+01:00[Europe/Paris]')");
        }

      default:
        throw new SQLException(
            "Cannot read " + clazz.getName() + " using a " + columnInfo.getColumnType()
                .getJavaTypeName() + " field");
    }

  }
214359
public static DateTime getDateTime(final ResultSet rs, final String columnName) throws SQLException
    {
        final Timestamp ts = rs.getTimestamp(columnName);

        return (ts == null) ? null : new DateTime(ts);
    }
617996
public com.google.protobuf.TimestampOrBuilder getTimestampValueOrBuilder() {
    if (typeCase_ == 5) {
      return (com.google.protobuf.Timestamp) type_;
    }
    return com.google.protobuf.Timestamp.getDefaultInstance();
  }
571136
public static java.sql.Time toTime(final Object value) {
		if (value == null) {
			return null;
		}
		if (value instanceof java.sql.Time) {
			return (java.sql.Time) value;
		}
		if (value instanceof java.util.Date) {
			final Date date = (java.util.Date) value;
			return new java.sql.Time(date.getTime());
		}
		return null;
	}
474579
@SuppressWarnings("unchecked")
	public Object toJdbc(final Object object, final Connection connection) {
		if (object == null) {
			return null;
		}
		for (@SuppressWarnings("rawtypes")
		BindParameterMapper parameterMapper : mappers) {
			if (parameterMapper.canAccept(object)) {
				return parameterMapper.toJdbc(object, connection, this);
			}
		}

		if (object instanceof Boolean || object instanceof Byte || object instanceof Short || object instanceof Integer
				|| object instanceof Long || object instanceof Float || object instanceof Double
				|| object instanceof BigDecimal || object instanceof String

				|| object instanceof byte[]

				|| object instanceof java.sql.Date || object instanceof java.sql.Time
				|| object instanceof java.sql.Timestamp || object instanceof java.sql.Array
				|| object instanceof java.sql.Ref || object instanceof java.sql.Blob || object instanceof java.sql.Clob
				|| object instanceof java.sql.SQLXML

				|| object instanceof java.sql.Struct) {
			return object;
		}

		for (@SuppressWarnings("rawtypes")
		BindParameterMapper parameterMapper : DEFAULT_MAPPERS) {
			if (parameterMapper.canAccept(object)) {
				return parameterMapper.toJdbc(object, connection, this);
			}
		}
		return object;
	}
1356849
public static java.sql.Date getSqlDate(int year, int month, int date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new java.util.Date(0));
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.MONTH, month - 1);
        cal.set(Calendar.DATE, date);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);

        return getSqlDate(cal.getTime());
    }
1000573
public static java.sql.Time toSqlTime(int hour, int minute, int second) {
		java.util.Date newDate = toDate(0, 0, 0, hour, minute, second);

		if (newDate != null)
			return new java.sql.Time(newDate.getTime());
		else
			return null;
	}
695750
public Timestamp getInternalTimestamp(ColumnInformation columnInfo, Calendar userCalendar,
      TimeZone timeZone) throws SQLException {
    if (lastValueWasNull()) {
      return null;
    }
    if (length == 0) {
      lastValueNull |= BIT_LAST_FIELD_NULL;
      return null;
    }

    int year = 1970;
    int month = 0;
    int day = 0;
    int hour = 0;
    int minutes = 0;
    int seconds = 0;
    int microseconds = 0;

    switch (columnInfo.getColumnType()) {
      case TIME:
        Calendar calendar = userCalendar != null ? userCalendar : Calendar.getInstance();

        boolean negate = false;
        if (length > 0) {
          negate = (buf[pos] & 0xff) == 0x01;
        }
        if (length > 4) {
          day = ((buf[pos + 1] & 0xff)
              + ((buf[pos + 2] & 0xff) << 8)
              + ((buf[pos + 3] & 0xff) << 16)
              + ((buf[pos + 4] & 0xff) << 24));
        }
        if (length > 7) {
          hour = buf[pos + 5];
          minutes = buf[pos + 6];
          seconds = buf[pos + 7];
        }

        if (length > 8) {
          microseconds = ((buf[pos + 8] & 0xff)
              + ((buf[pos + 9] & 0xff) << 8)
              + ((buf[pos + 10] & 0xff) << 16)
              + ((buf[pos + 11] & 0xff) << 24));
        }
        year = 1970;
        month = 1;
        day = ((negate ? -1 : 1) * day) + 1;
        hour = (negate ? -1 : 1) * hour;
        break;

      case STRING:
      case VARSTRING:
        String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8);
        if (rawValue.startsWith("0000-00-00 00:00:00")) {
          lastValueNull |= BIT_LAST_ZERO_DATE;
          return null;
        }

        if (rawValue.length() >= 4) {
          year = Integer.parseInt(rawValue.substring(0, 4));
          if (rawValue.length() >= 7) {
            month = Integer.parseInt(rawValue.substring(5, 7));
            if (rawValue.length() >= 10) {
              day = Integer.parseInt(rawValue.substring(8, 10));
              if (rawValue.length() >= 19) {
                hour = Integer.parseInt(rawValue.substring(11, 13));
                minutes = Integer.parseInt(rawValue.substring(14, 16));
                seconds = Integer.parseInt(rawValue.substring(17, 19));
              }
              microseconds = extractNanos(rawValue) / 1000000;
            }
          }
        }
        break;

      default:
        year = ((buf[pos] & 0xff) | (buf[pos + 1] & 0xff) << 8);
        month = buf[pos + 2];
        day = buf[pos + 3];
        if (length > 4) {
          hour = buf[pos + 4];
          minutes = buf[pos + 5];
          seconds = buf[pos + 6];

          if (length > 7) {
            microseconds = ((buf[pos + 7] & 0xff)
                + ((buf[pos + 8] & 0xff) << 8)
                + ((buf[pos + 9] & 0xff) << 16)
                + ((buf[pos + 10] & 0xff) << 24));
          }
        }
    }

    Calendar calendar;
    if (userCalendar != null) {
      calendar = userCalendar;
    } else if (columnInfo.getColumnType().getSqlType() == Types.TIMESTAMP) {
      calendar = Calendar.getInstance(timeZone);
    } else {
      calendar = Calendar.getInstance();
    }

    Timestamp tt;
    synchronized (calendar) {
      calendar.clear();
      calendar.set(year, month - 1, day, hour, minutes, seconds);
      tt = new Timestamp(calendar.getTimeInMillis());
    }
    tt.setNanos(microseconds * 1000);
    return tt;
  }
1169022
public OffsetTime getInternalOffsetTime(ColumnInformation columnInfo, TimeZone timeZone)
      throws SQLException {
    if (lastValueWasNull()) {
      return null;
    }
    if (length == 0) {
      lastValueNull |= BIT_LAST_FIELD_NULL;
      return null;
    }

    ZoneId zoneId = timeZone.toZoneId().normalized();
    if (zoneId instanceof ZoneOffset) {
      ZoneOffset zoneOffset = (ZoneOffset) zoneId;
      String raw = new String(buf, pos, length, StandardCharsets.UTF_8);
      switch (columnInfo.getColumnType().getSqlType()) {

        case Types.TIMESTAMP:
          if (raw.startsWith("0000-00-00 00:00:00")) {
            return null;
          }
          try {
            return ZonedDateTime.parse(raw, TEXT_LOCAL_DATE_TIME.withZone(zoneOffset))
                .toOffsetDateTime().toOffsetTime();
          } catch (DateTimeParseException dateParserEx) {
            throw new SQLException(raw
                + " cannot be parse as OffsetTime. time must have \"yyyy-MM-dd HH:mm:ss[.S]\" format");
          }

        case Types.TIME:
          try {
            LocalTime localTime = LocalTime
                .parse(raw, DateTimeFormatter.ISO_LOCAL_TIME.withZone(zoneOffset));
            return OffsetTime.of(localTime, zoneOffset);
          } catch (DateTimeParseException dateParserEx) {
            throw new SQLException(
                raw + " cannot be parse as OffsetTime (format is \"HH:mm:ss[.S]\" for data type \""
                    + columnInfo.getColumnType() + "\")");
          }

        case Types.VARCHAR:
        case Types.LONGVARCHAR:
        case Types.CHAR:
          try {
            return OffsetTime.parse(raw, DateTimeFormatter.ISO_OFFSET_TIME);
          } catch (DateTimeParseException dateParserEx) {
            throw new SQLException(raw
                + " cannot be parse as OffsetTime (format is \"HH:mm:ss[.S]\" with offset for data type \""
                + columnInfo.getColumnType() + "\")");
          }

        default:
          throw new SQLException("Cannot read " + OffsetTime.class.getName() + " using a "
              + columnInfo.getColumnType().getJavaTypeName() + " field");
      }
    }

    if (options.useLegacyDatetimeCode) {
      //system timezone is not an offset
      throw new SQLException(
          "Cannot return an OffsetTime for a TIME field when default timezone is '" + zoneId
              + "' (only possible for time-zone offset from Greenwich/UTC, such as +02:00)");
    }

    //server timezone is not an offset
    throw new SQLException(
        "Cannot return an OffsetTime for a TIME field when server timezone '" + zoneId
            + "' (only possible for time-zone offset from Greenwich/UTC, such as +02:00)");

  }
1313831
private static Object toDatabaseSupportedValue(Object value) {
        if (value instanceof java.lang.String ||
                value instanceof byte[] ||
                value instanceof Byte[] ||
                value instanceof java.lang.Long ||
                value instanceof java.lang.Integer ||
                value instanceof java.lang.Boolean ||
                value instanceof java.math.BigInteger ||
                value instanceof java.lang.Float ||
                value instanceof java.lang.Double ||
                value instanceof java.math.BigDecimal ||
                value instanceof java.sql.Date ||
                value instanceof java.util.Date ||
                /*
                because java.sql.Time and java.sql.Timestamp is subclass of java.sql.Date so the checks always return true
                value instanceof java.sql.Time || value instanceof java.sql.Timestamp ||
                */
                value instanceof java.util.Calendar
                ) {
            return value;
        } else {
            return Reflection.toType(value, String.class);
        }
    }
454056
public static java.sql.Timestamp convertSqlDate(Date dt) {
        if (dt == null) {
            return new java.sql.Timestamp(0);
        }
        return new java.sql.Timestamp(dt.getTime());
    }
670274
private String getTimeString(Date value)
   {
      Calendar cal = DateHelper.popCalendar(value);
      int hours = cal.get(Calendar.HOUR_OF_DAY);
      int minutes = cal.get(Calendar.MINUTE);
      DateHelper.pushCalendar(cal);
      
      StringBuilder sb = new StringBuilder(4);
      sb.append(m_twoDigitFormat.format(hours));
      sb.append(m_twoDigitFormat.format(minutes));

      return (sb.toString());
   }
1032311
public static java.sql.Timestamp getSqlTimeStamp(java.util.Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return new java.sql.Timestamp(cal.getTimeInMillis());
    }
1197758
public static java.sql.Time toSqlTime(String time) {
		java.util.Date newDate = toDate("1/1/1970", time);

		if (newDate != null)
			return new java.sql.Time(newDate.getTime());
		else
			return null;
	}
528988
@Override
    public Date getDate(String parameterName, Calendar cal) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }