Package java.sql

Examples of java.sql.Time


     * @param x the time
     * @param source the calendar
     * @return the time in UTC
     */
    public static Value convertTimeToUTC(Time x, Calendar source) {
        return ValueTime.get(new Time(convertToUTC(x, source)));
    }
View Full Code Here


        s -= m * 60;
        long h = m / 60;
        m -= h * 60;
        long ms = getMillis(TimeZone.getDefault(),
                1970, 1, 1, (int) (h % 24), (int) m, (int) s, (int) millis);
        return new Time(ms);
    }
View Full Code Here

    public static Time deserializeSqlTime(String text)
        throws JiBXException {
        if (text == null) {
            return null;
        } else {
            return new Time(parseTime(text, 0, text.length()));
        }
    }
View Full Code Here

                Date value = rs.getDate(columnIndex);
                v = value == null ? (Value) ValueNull.INSTANCE : ValueDate.get(value);
                break;
            }
            case Value.TIME: {
                Time value = rs.getTime(columnIndex);
                v = value == null ? (Value) ValueNull.INSTANCE : ValueTime.get(value);
                break;
            }
            case Value.TIMESTAMP: {
                Timestamp value = rs.getTimestamp(columnIndex);
View Full Code Here

        }
        case CURTIME:
        case CURRENT_TIME: {
            long now = session.getTransactionStart();
            // need to normalize
            result = ValueTime.get(new Time(now));
            break;
        }
        case NOW:
        case CURRENT_TIMESTAMP: {
            long now = session.getTransactionStart();
View Full Code Here

            long nanos = readVarLong() * 1000000 + readVarLong();
            return ValueTime.fromNanos(nanos);
        }
        case Value.TIME:
            // need to normalize the year, month and day
            return ValueTime.get(new Time(DateTimeUtils.getTimeUTCWithoutDst(readVarLong())));
        case LOCAL_TIMESTAMP: {
            long dateValue = readVarLong();
            long nanos = readVarLong() * 1000000 + readVarLong();
            return ValueTimestamp.fromDateValueAndNanos(dateValue, nanos);
        }
View Full Code Here

    public Time getTime(int columnIndex, Calendar calendar) throws SQLException {
        try {
            if (isDebugEnabled()) {
                debugCode("getTime(" + columnIndex + ", calendar)");
            }
            Time x = get(columnIndex).getTime();
            return DateTimeUtils.convertTimeToCalendar(x, calendar);
        } catch (Exception e) {
            throw logAndConvert(e);
        }
    }
View Full Code Here

    public Time getTime(String columnLabel, Calendar calendar) throws SQLException {
        try {
            if (isDebugEnabled()) {
                debugCode("getTime(" + StringUtils.quoteJavaString(columnLabel) + ", calendar)");
            }
            Time x = get(columnLabel).getTime();
            return DateTimeUtils.convertTimeToCalendar(x, calendar);
        } catch (Exception e) {
            throw logAndConvert(e);
        }
    }
View Full Code Here

            return ValueDate.get(new Date(readLong()));
        case Value.TIME:
            if (version >= Constants.TCP_PROTOCOL_VERSION_9) {
                return ValueTime.fromNanos(readLong());
            } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
                return ValueTime.get(new Time(DateTimeUtils.getTimeUTCWithoutDst(readLong())));
            }
            return ValueTime.get(new Time(readLong()));
        case Value.TIMESTAMP: {
            if (version >= Constants.TCP_PROTOCOL_VERSION_9) {
                return ValueTimestamp.fromDateValueAndNanos(readLong(), readLong());
            } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
                Timestamp ts = new Timestamp(DateTimeUtils.getTimeUTCWithoutDst(readLong()));
View Full Code Here

      case Types.LONGVARCHAR:
        return Any.create(set.getString(field));

      case Types.TIME:
        {
          Time time = set.getTime(field);
          if (time != null) {
            Context context = Context.getInstance();
            Calendar cal = Calendar.getInstance(context.getTimeZone(), context.getLocale());
            cal.setTime(time);
            return new AnyCalendar(cal);
View Full Code Here

TOP

Related Classes of java.sql.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.