当前位置: 首页>>代码示例>>Java>>正文


Java HsqlDateTime.getNormalisedTime方法代码示例

本文整理汇总了Java中org.hsqldb.HsqlDateTime.getNormalisedTime方法的典型用法代码示例。如果您正苦于以下问题:Java HsqlDateTime.getNormalisedTime方法的具体用法?Java HsqlDateTime.getNormalisedTime怎么用?Java HsqlDateTime.getNormalisedTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hsqldb.HsqlDateTime的用法示例。


在下文中一共展示了HsqlDateTime.getNormalisedTime方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
protected TimeData readTime(Type type) {

        readField();

        if (value == null) {
            return null;
        }

        if (version18) {
            java.sql.Time dateTime = java.sql.Time.valueOf((String) value);
            long millis =
                HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
                    dateTime.getTime());

            millis = HsqlDateTime.getNormalisedTime(millis);

            return new TimeData((int) millis / 1000, 0, 0);
        }

        return scanner.newTime((String) value);
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:22,代码来源:RowInputTextLog.java

示例2: readTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
protected TimeData readTime(Type type) throws IOException {

        readField();

        if (value == null) {
            return null;
        }

        if (version18) {
            java.sql.Time dateTime = java.sql.Time.valueOf((String) value);
            long millis =
                HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
                    dateTime.getTime());

            millis = HsqlDateTime.getNormalisedTime(millis);

            return new TimeData((int) millis / 1000, 0, 0);
        }

        return scanner.newTime((String) value);
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:22,代码来源:RowInputTextLog.java

示例3: readTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
protected TimeData readTime(Type type) {

        if (type.typeCode == Types.SQL_TIME) {
            long millis = readLong();

            millis = HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
                    millis);
            millis = HsqlDateTime.getNormalisedTime(millis);

            return new TimeData((int) (millis / 1000), 0, 0);
        } else {
            return new TimeData(readInt(), readInt(), readInt());
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:15,代码来源:RowInputBinary180.java

示例4: truncate

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
public Object truncate(Object a, int part) {

        if (a == null) {
            return null;
        }

        long millis = getMillis(a);

        millis = HsqlDateTime.getTruncatedPart(millis, part);
        millis -= getZoneMillis(a);

        switch (typeCode) {

            case Types.SQL_TIME_WITH_TIME_ZONE :
                millis = HsqlDateTime.getNormalisedTime(millis);
            case Types.SQL_TIME : {
                return new TimeData((int) (millis / 1000), 0,
                                    ((TimeData) a).getZone());
            }
            case Types.SQL_DATE :
            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            case Types.SQL_TIMESTAMP : {
                return new TimestampData(millis / 1000, 0,
                                         ((TimestampData) a).getZone());
            }
            default :
        }

        throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType");
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:31,代码来源:DateTimeType.java

示例5: round

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
public Object round(Object a, int part) {

        if (a == null) {
            return null;
        }

        long millis = getMillis(a);

        millis = HsqlDateTime.getRoundedPart(millis, part);
        millis -= getZoneMillis(a);

        switch (typeCode) {

            case Types.SQL_TIME_WITH_TIME_ZONE :
            case Types.SQL_TIME : {
                millis = HsqlDateTime.getNormalisedTime(millis);

                return new TimeData((int) (millis / 1000), 0,
                                    ((TimeData) a).getZone());
            }
            case Types.SQL_DATE :
            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            case Types.SQL_TIMESTAMP : {
                return new TimestampData(millis / 1000, 0,
                                         ((TimestampData) a).getZone());
            }
            default :
        }

        throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType");
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:32,代码来源:DateTimeType.java

示例6: getValue

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
public Object getValue(long seconds, int nanos, int zoneSeconds) {

        switch (typeCode) {

            case Types.SQL_DATE :
                seconds =
                    HsqlDateTime.getNormalisedDate(
                        (seconds + zoneSeconds) * 1000) / 1000;

                return new TimestampData(seconds);

            case Types.SQL_TIME_WITH_TIME_ZONE :
                seconds = HsqlDateTime.getNormalisedDate(seconds * 1000)
                          / 1000;

                return new TimeData((int) seconds, nanos, zoneSeconds);

            case Types.SQL_TIME :
                seconds =
                    HsqlDateTime.getNormalisedTime(
                        (seconds + zoneSeconds) * 1000) / 1000;

                return new TimeData((int) seconds, nanos);

            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
                return new TimestampData(seconds, nanos, zoneSeconds);

            case Types.SQL_TIMESTAMP :
                return new TimestampData(seconds + zoneSeconds, nanos);

            default :
                throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType");
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:35,代码来源:DateTimeType.java

示例7: readTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
protected TimeData readTime(Type type) throws IOException {

        if (type.typeCode == Types.SQL_TIME) {
            long millis = readLong();

            millis = HsqlDateTime.convertMillisFromCalendar(
                tempCalDefault, millis);
            millis = HsqlDateTime.getNormalisedTime(millis);

            return new TimeData((int) (millis / 1000), 0, 0);
        } else {
            return new TimeData(readInt(), readInt(), readInt());
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:15,代码来源:RowInputBinary180.java

示例8: getTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 *
 * Retrieves the value of the designated JDBC <code>TIME</code> parameter as a
 * <code>java.sql.Time</code> object, using
 * the given <code>Calendar</code> object
 * to construct the time.
 * With a <code>Calendar</code> object, the driver
 * can calculate the time taking into account a custom timezone and locale.
 * If no <code>Calendar</code> object is specified, the driver uses the
 * default timezone and locale.
 *
 * <!-- end generic documentation -->
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * HSQLDB supports this feature. <p>
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param parameterIndex the first parameter is 1, the second is 2,
 * and so on
 * @param cal the <code>Calendar</code> object the driver will use
 *            to construct the time
 * @return the parameter value; if the value is SQL <code>NULL</code>, the result
 *         is <code>null</code>.
 * @exception SQLException  JDBC 4.1[if the parameterIndex is not valid;]
 * if a database access error occurs or
 * this method is called on a closed <code>CallableStatement</code>
 * @see #setTime
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *    JDBCParameterMetaData)
 */
public synchronized Time getTime(int parameterIndex,
                                 Calendar cal) throws SQLException {

    TimeData t = (TimeData) getColumnInType(parameterIndex, Type.SQL_TIME);

    if (t == null) {
        return null;
    }

    long millis = DateTimeType.normaliseTime(t.getSeconds()) * 1000L;

    if (!parameterMetaData.columnTypes[--parameterIndex]
            .isDateTimeTypeWithZone()) {
        Calendar calendar = cal == null ? session.getCalendar()
                : cal;

        millis = HsqlDateTime.convertMillisToCalendar(calendar, millis);
        millis = HsqlDateTime.getNormalisedTime(millis);
    }

    return new Time(millis);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:59,代码来源:JDBCCallableStatement.java

示例9: getTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Retrieves the value of the designated column in the current row
 * of this <code>ResultSet</code> object as a <code>java.sql.Time</code>
 * object in the Java programming language.
 * This method uses the given calendar to construct an appropriate millisecond
 * value for the time if the underlying database does not store
 * timezone information.
 * <!-- end generic documentation -->
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * The JDBC specification for this method is vague. HSQLDB interprets the
 * specification as follows:
 *
 * <ol>
 * <li>If the SQL type of the column is WITH TIME ZONE, then the UTC value
 * of the returned java.sql.Time object is the UTC of the SQL value without
 * modification. In other words, the Calendar object is not used.</li>
 * <li>If the SQL type of the column is WITHOUT TIME ZONE, then the UTC
 * value of the returned java.sql.Time is correct for the given Calendar
 * object.</li>
 * <li>If the cal argument is null, it it ignored and the method returns
 * the same Object as the method without the Calendar parameter.</li>
 * </ol>
 * </div>
 *
 * @param columnIndex the first column is 1, the second is 2, ...
 * @param cal the <code>java.util.Calendar</code> object
 * to use in constructing the time
 * @return the column value as a <code>java.sql.Time</code> object;
 * if the value is SQL <code>NULL</code>,
 * the value returned is <code>null</code> in the Java programming language
 * @exception SQLException if a database access error occurs
 * or this method is called on a closed result set
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *   JDBCResultSet)
 */
public Time getTime(int columnIndex, Calendar cal) throws SQLException {

    TimeData t = (TimeData) getColumnInType(columnIndex, Type.SQL_TIME);

    if (t == null) {
        return null;
    }

    long millis = DateTimeType.normaliseTime(t.getSeconds()) * 1000L;

    if (!resultMetaData.columnTypes[--columnIndex]
            .isDateTimeTypeWithZone()) {
        Calendar calendar = cal == null ? session.getCalendar()
                : cal;

        millis = HsqlDateTime.convertMillisToCalendar(calendar, millis);
        millis = HsqlDateTime.getNormalisedTime(millis);
    }

    return new Time(millis);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:59,代码来源:JDBCResultSet.java

示例10: getTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 *
 * Retrieves the value of the designated JDBC <code>TIME</code> parameter as a
 * <code>java.sql.Time</code> object, using
 * the given <code>Calendar</code> object
 * to construct the time.
 * With a <code>Calendar</code> object, the driver
 * can calculate the time taking into account a custom timezone and locale.
 * If no <code>Calendar</code> object is specified, the driver uses the
 * default timezone and locale.
 *
 * <!-- end generic documentation -->
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * HSQLDB supports this feature. <p>
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param parameterIndex the first parameter is 1, the second is 2,
 * and so on
 * @param cal the <code>Calendar</code> object the driver will use
 *            to construct the time
 * @return the parameter value; if the value is SQL <code>NULL</code>, the result
 *         is <code>null</code>.
 * @exception SQLException  JDBC 4.1[if the parameterIndex is not valid;]
 * if a database access error occurs or
 * this method is called on a closed <code>CallableStatement</code>
 * @see #setTime
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *    JDBCParameterMetaData)
 */
public synchronized Time getTime(int parameterIndex,
                                 Calendar cal) throws SQLException {

    TimeData t = (TimeData) getColumnInType(parameterIndex, Type.SQL_TIME);

    if (t == null) {
        return null;
    }

    long millis = DateTimeType.normaliseTime(t.getSeconds()) * 1000;

    if (!parameterMetaData.columnTypes[--parameterIndex]
            .isDateTimeTypeWithZone()) {
        Calendar calendar = cal == null ? session.getCalendar()
                : cal;

        millis = HsqlDateTime.convertMillisToCalendar(calendar, millis);
        millis = HsqlDateTime.getNormalisedTime(millis);
    }

    return new Time(millis);
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:59,代码来源:JDBCCallableStatement.java

示例11: getTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Retrieves the value of the designated column in the current row
 * of this <code>ResultSet</code> object as a <code>java.sql.Time</code>
 * object in the Java programming language.
 * This method uses the given calendar to construct an appropriate millisecond
 * value for the time if the underlying database does not store
 * timezone information.
 * <!-- end generic documentation -->
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * The JDBC specification for this method is vague. HSQLDB interprets the
 * specification as follows:
 *
 * <ol>
 * <li>If the SQL type of the column is WITH TIME ZONE, then the UTC value
 * of the returned java.sql.Time object is the UTC of the SQL value without
 * modification. In other words, the Calendar object is not used.</li>
 * <li>If the SQL type of the column is WITHOUT TIME ZONE, then the UTC
 * value of the returned java.sql.Time is correct for the given Calendar
 * object.</li>
 * <li>If the cal argument is null, it it ignored and the method returns
 * the same Object as the method without the Calendar parameter.</li>
 * </ol>
 * </div>
 *
 * @param columnIndex the first column is 1, the second is 2, ...
 * @param cal the <code>java.util.Calendar</code> object
 * to use in constructing the time
 * @return the column value as a <code>java.sql.Time</code> object;
 * if the value is SQL <code>NULL</code>,
 * the value returned is <code>null</code> in the Java programming language
 * @exception SQLException if a database access error occurs
 * or this method is called on a closed result set
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *   JDBCResultSet)
 */
public Time getTime(int columnIndex, Calendar cal) throws SQLException {

    TimeData t = (TimeData) getColumnInType(columnIndex, Type.SQL_TIME);

    if (t == null) {
        return null;
    }

    long millis = DateTimeType.normaliseTime(t.getSeconds()) * 1000;

    if (!resultMetaData.columnTypes[--columnIndex]
            .isDateTimeTypeWithZone()) {
        Calendar calendar = cal == null ? session.getCalendar()
                : cal;

        millis = HsqlDateTime.convertMillisToCalendar(calendar, millis);
        millis = HsqlDateTime.getNormalisedTime(millis);
    }

    return new Time(millis);
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:59,代码来源:JDBCResultSet.java

示例12: readTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
protected Time readTime() throws IOException, HsqlException {
    return new Time(HsqlDateTime.getNormalisedTime(readLong()));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:RowInputBinary.java

示例13: readTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/** @todo fredt - get time and data longs then normalise before fetching value */
protected java.sql.Time readTime() throws IOException, HsqlException {
    return HsqlDateTime.getNormalisedTime(readLong());
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:RowInputBinary.java

示例14: setParameter

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
     * The internal parameter value setter always converts the parameter to
     * the Java type required for data transmission. Target BINARY and OTHER
     * types are converted directly. All other target types are converted
     * by Column.convertObject(). This also normalizes DATETIME values.
     *
     * @param i parameter index
     * @param o object
     * @throws SQLException if either argument is not acceptable.
     */
    private void setParameter(int i, Object o) throws SQLException {

        checkSetParameterIndex(i);

        i--;

        if (o == null) {
            parameterValues[i] = null;

            return;
        }

        int outType = parameterTypes[i];

        try {
            if (outType == Types.OTHER) {
                o = new JavaObject((Serializable) o);
            } else if (outType == Types.BINARY) {
                if (!(o instanceof byte[])) {
                    throw jdbcUtil.sqlException(
                        Trace.error(Trace.INVALID_CONVERSION));
                }

                o = new Binary((byte[]) o, !connection.isNetConn);
            } else {
                Object oldobject = o;

                o = Column.convertObject(o, outType);

                // this ensures duplicate objects are stored as internal or ValuePool objects
                // in order to avoid possible subsequent modifications
                if (o == oldobject) {
                    if (outType == Types.DATE) {
                        o = HsqlDateTime.getNormalisedDate((java.sql.Date) o);
                    } else if (outType == Types.TIME
                               &&!connection.isNetConn) {
                        o = HsqlDateTime.getNormalisedTime((java.sql.Time) o);
                    } else if (outType == Types.TIMESTAMP
                               &&!connection.isNetConn) {

//#ifdef JAVA1TARGET
/*
*/

//#else
                        o = ((java.sql.Timestamp) o).clone();

//#endif JAVA1TARGET
                    }
                }
            }
        } catch (HsqlException e) {
            jdbcUtil.throwError(e);
        }

        parameterValues[i] = o;
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:68,代码来源:jdbcPreparedStatement.java


注:本文中的org.hsqldb.HsqlDateTime.getNormalisedTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。