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


Java HsqlDateTime.getNormalisedDate方法代码示例

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


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

示例1: readDate

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

        readField();

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

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

            millis = HsqlDateTime.getNormalisedDate(millis);

            return new TimestampData(millis / 1000);
        }

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

示例2: readDate

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

        readField();

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

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

            millis = HsqlDateTime.getNormalisedDate(millis);

            return new TimestampData(millis / 1000);
        }

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

示例3: 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

示例4: setDate

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Sets the designated parameter to the given <code>java.sql.Date</code> value,
 * using the given <code>Calendar</code> object.  The driver uses
 * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
 * which the driver then sends to the database.  With
 * a <code>Calendar</code> object, the driver can calculate the date
 * taking into account a custom timezone.  If no
 * <code>Calendar</code> object is specified, the driver uses the default
 * timezone, which is that of the virtual machine running the application.
 * <!-- end generic documentation -->
 *
 * @param parameterIndex the first parameter is 1, the second is 2, ...
 * @param x the parameter value
 * @param cal the <code>Calendar</code> object the driver will use
 *            to construct the date
 * @exception SQLException if a database access error occurs or
 * this method is called on a closed <code>PreparedStatement</code>
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *   JDBCParameterMetaData)
 */
public synchronized void setDate(int parameterIndex, Date x,
                                 Calendar cal) throws SQLException {

    checkSetParameterIndex(parameterIndex);

    int i = parameterIndex - 1;

    if (x == null) {
        parameterValues[i] = null;
        parameterSet[i]    = Boolean.TRUE;

        return;
    }

    Type outType = parameterTypes[i];
    Calendar calendar = cal == null ? session.getCalendar()
            : cal;

    long millis = HsqlDateTime.convertMillisFromCalendar(
            session.getCalendarGMT(), calendar, x.getTime());

    millis = HsqlDateTime.getNormalisedDate(session.getCalendarGMT(),
            millis);

    switch (outType.typeCode) {

        case Types.SQL_DATE :
        case Types.SQL_TIMESTAMP :
            parameterValues[i] = new TimestampData(millis / 1000);

            break;
        case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            int zoneOffset = HsqlDateTime.getZoneMillis(calendar, millis);

            parameterValues[i] = new TimestampData(millis / 1000, 0,
                    zoneOffset / 1000);

            break;
        default :
            throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }
    parameterSet[i] = Boolean.TRUE;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:65,代码来源:JDBCPreparedStatement.java

示例5: setDate

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Sets the designated parameter to the given <code>java.sql.Date</code> value,
 * using the given <code>Calendar</code> object.  The driver uses
 * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
 * which the driver then sends to the database.  With
 * a <code>Calendar</code> object, the driver can calculate the date
 * taking into account a custom timezone.  If no
 * <code>Calendar</code> object is specified, the driver uses the default
 * timezone, which is that of the virtual machine running the application.
 * <!-- end generic documentation -->
 *
 * @param parameterIndex the first parameter is 1, the second is 2, ...
 * @param x the parameter value
 * @param cal the <code>Calendar</code> object the driver will use
 *            to construct the date
 * @exception SQLException if a database access error occurs or
 * this method is called on a closed <code>PreparedStatement</code>
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *   JDBCParameterMetaData)
 */
public synchronized void setDate(int parameterIndex, Date x,
                                 Calendar cal) throws SQLException {

    checkSetParameterIndex(parameterIndex);

    int i = parameterIndex - 1;

    if (x == null) {
        parameterValues[i] = null;
        parameterSet[i]    = Boolean.TRUE;

        return;
    }

    Type outType = parameterTypes[i];
    Calendar calendar   = cal == null ? session.getCalendar()
            : cal;

    long millis  = HsqlDateTime.convertMillisFromCalendar(calendar,
        x.getTime());

    millis = HsqlDateTime.getNormalisedDate(millis);

    switch (outType.typeCode) {

        case Types.SQL_DATE :
        case Types.SQL_TIMESTAMP :
            parameterValues[i] = new TimestampData(millis / 1000);

            break;
        case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            int zoneOffset = HsqlDateTime.getZoneMillis(calendar, millis);

            parameterValues[i] = new TimestampData(millis / 1000, 0,
                    zoneOffset / 1000);

            break;
        default :
            throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }
    parameterSet[i] = Boolean.TRUE;
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:64,代码来源:JDBCPreparedStatement.java

示例6: 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

示例7: readDate

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

        long millis = readLong();

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

        return new TimestampData(millis / 1000);
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:11,代码来源:RowInputBinary180.java

示例8: readDate

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

        long millis = readLong();

        millis = HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
                                               millis);

        millis = HsqlDateTime.getNormalisedDate(millis);

        return new TimestampData(millis / 1000);
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:12,代码来源:RowInputBinary180.java

示例9: readDate

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
protected java.sql.Date readDate() throws IOException, HsqlException {

        long date = HsqlDateTime.getNormalisedDate(readLong());

        return ValuePool.getDate(date);
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:7,代码来源:RowInputBinary.java

示例10: readDate

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
protected Date readDate() throws IOException, HsqlException {

        long date = HsqlDateTime.getNormalisedDate(readLong());

        return ValuePool.getDate(date);
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:7,代码来源:RowInputBinary.java


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