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


Java HsqlDateTime.convertMillisFromCalendar方法代码示例

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


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

示例3: readTimestamp

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

        readField();

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

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

            nanos = DateTimeType.normaliseFraction(nanos, type.scale);

            return new TimestampData(millis / 1000, nanos, 0);
        }

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

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

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

示例6: readTimestamp

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

        readField();

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

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

            nanos = ((DateTimeType) type).normaliseFraction(nanos, type.scale);

            return new TimestampData(millis / 1000, nanos, 0);
        }

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

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

示例8: readTimestamp

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

        if (type.typeCode == Types.SQL_TIMESTAMP) {
            long millis = readLong();
            int  nanos  = readInt();

            millis = HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
                    millis);

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

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

示例10: readTimestamp

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

        if (type.typeCode == Types.SQL_TIMESTAMP) {
            long millis = readLong();
            int  nanos  = readInt();

            millis = HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
                                                   millis);

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

示例11: setTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Sets the designated parameter to the given <code>java.sql.Time</code> value,
 * using the given <code>Calendar</code> object.  The driver uses
 * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
 * which the driver then sends to the database.  With
 * a <code>Calendar</code> object, the driver can calculate the time
 * 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 -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * When a setXXX method is used to set a parameter of type
 * TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone (including
 * Daylight Saving Time) of the Calendar is used as time zone for the
 * value.<p>
 *
 * </div>
 * <!-- end release-specific 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 time
 * @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 setTime(int parameterIndex, Time 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];
    long     millis     = x.getTime();
    int      zoneOffset = 0;
    Calendar calendar   = cal == null ? session.getCalendar()
            : cal;

    millis = HsqlDateTime.convertMillisFromCalendar(calendar, millis);
    millis = HsqlDateTime.convertToNormalisedTime(millis);

    switch (outType.typeCode) {

        case Types.SQL_TIME :
            break;
        case Types.SQL_TIME_WITH_TIME_ZONE :
            zoneOffset = HsqlDateTime.getZoneMillis(calendar, millis);

            break;
        default :
            throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }
    parameterValues[i] = new TimeData((int) (millis / 1000), 0,
            zoneOffset / 1000);
    parameterSet[i] = Boolean.TRUE;
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:70,代码来源:JDBCPreparedStatement.java

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

示例13: setTime

import org.hsqldb.HsqlDateTime; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Sets the designated parameter to the given <code>java.sql.Time</code> value,
 * using the given <code>Calendar</code> object.  The driver uses
 * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
 * which the driver then sends to the database.  With
 * a <code>Calendar</code> object, the driver can calculate the time
 * 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 -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * When a setXXX method is used to set a parameter of type
 * TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone (including
 * Daylight Saving Time) of the Calendar is used as time zone for the
 * value.<p>
 *
 * </div>
 * <!-- end release-specific 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 time
 * @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 setTime(int parameterIndex, Time 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];
    long     millis     = x.getTime();
    int      zoneOffset = 0;
    Calendar calendar   = cal == null ? session.getCalendar()
            : cal;

    millis = HsqlDateTime.convertMillisFromCalendar(
            session.getCalendarGMT(), calendar, millis);
    millis = HsqlDateTime.convertToNormalisedTime(millis,
            session.getCalendarGMT());

    switch (outType.typeCode) {

        case Types.SQL_TIME :
            break;
        case Types.SQL_TIME_WITH_TIME_ZONE :
            zoneOffset = HsqlDateTime.getZoneMillis(calendar, millis);

            break;
        default :
            throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }
    parameterValues[i] = new TimeData((int) (millis / 1000), 0,
            zoneOffset / 1000);
    parameterSet[i] = Boolean.TRUE;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:72,代码来源:JDBCPreparedStatement.java

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

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


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