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


Java TimestampData.getSeconds方法代码示例

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


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

示例1: writeTimestamp

import org.hsqldb.types.TimestampData; //导入方法依赖的package包/类
protected void writeTimestamp(TimestampData o, Type type) {

        if (type.typeCode == Types.SQL_TIMESTAMP) {
            long millis = o.getSeconds() * 1000L;

            millis = HsqlDateTime.convertMillisToCalendar(tempCalDefault,
                    millis);

            writeLong(millis);
            writeInt(o.getNanos());
        } else {
            writeLong(o.getSeconds());
            writeInt(o.getNanos());
            writeInt(o.getZone());
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:17,代码来源:RowOutputBinary180.java

示例2: getDate

import org.hsqldb.types.TimestampData; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 *
 * Retrieves the value of the designated JDBC <code>DATE</code> parameter as a
 * <code>java.sql.Date</code> object, using
 * the given <code>Calendar</code> object
 * to construct the date.
 * With a <code>Calendar</code> object, the driver
 * can calculate the date 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 date
 * @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 #setDate
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *      JDBCParameterMetaData)
 */
public synchronized Date getDate(int parameterIndex,
                                 Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(parameterIndex,
        Type.SQL_DATE);

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

    long millis = t.getSeconds() * 1000;

    if (cal != null) {
        millis = HsqlDateTime.convertMillisToCalendar(cal, millis);
    }

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

示例3: getDate

import org.hsqldb.types.TimestampData; //导入方法依赖的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.Date</code> object
 * in the Java programming language.
 * This method uses the given calendar to construct an appropriate millisecond
 * value for the date if the underlying database does not store
 * timezone information.
 * <!-- end generic documentation -->
 *
 * @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 date
 * @return the column value as a <code>java.sql.Date</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 Date getDate(int columnIndex, Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(columnIndex,
        Type.SQL_DATE);

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

    long millis = t.getSeconds() * 1000;

    if (cal != null) {
        millis = HsqlDateTime.convertMillisToCalendar(cal, millis);
    }

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

示例4: writeDate

import org.hsqldb.types.TimestampData; //导入方法依赖的package包/类
protected void writeDate(TimestampData o, Type type) {

        long millis = o.getSeconds() * 1000L;

        millis = HsqlDateTime.convertMillisToCalendar(tempCalDefault, millis);

        writeLong(millis);
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:9,代码来源:RowOutputBinary180.java

示例5: getTimestamp

import org.hsqldb.types.TimestampData; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 *
 * Retrieves the value of the designated JDBC <code>TIMESTAMP</code> parameter as a
 * <code>java.sql.Timestamp</code> object, using
 * the given <code>Calendar</code> object to construct
 * the <code>Timestamp</code> object.
 * With a <code>Calendar</code> object, the driver
 * can calculate the timestamp 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 timestamp
 * @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 #setTimestamp
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *    JDBCParameterMetaData)
 */
public synchronized Timestamp getTimestamp(int parameterIndex,
        Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(parameterIndex,
        Type.SQL_TIMESTAMP);

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

    long millis = t.getSeconds() * 1000;

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

        if (cal != null) {
            millis = HsqlDateTime.convertMillisToCalendar(calendar,
                    millis);
        }
    }

    Timestamp ts = new Timestamp(millis);

    ts.setNanos(t.getNanos());

    return ts;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:66,代码来源:JDBCCallableStatement.java

示例6: getTimestamp

import org.hsqldb.types.TimestampData; //导入方法依赖的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.Timestamp</code> object
 * in the Java programming language.
 * This method uses the given calendar to construct an appropriate millisecond
 * value for the timestamp 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.Timestamp 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.Timestamp will represent the correct
 * timestamp for the time zone (including daylight saving time) of the given
 * Calendar object. </li>
 * <li>In this case, if the cal argument is null, then the default Calendar
 * of the JVM is used, which results in the same Object as one returned by the
 * getTimestamp() methods 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 timestamp
 * @return the column value as a <code>java.sql.Timestamp</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 Timestamp getTimestamp(int columnIndex,
                              Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(columnIndex,
        Type.SQL_TIMESTAMP);

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

    long millis = t.getSeconds() * 1000;

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

        if (cal != null) {
            millis = HsqlDateTime.convertMillisToCalendar(calendar,
                    millis);
        }
    }

    Timestamp ts = new Timestamp(millis);

    ts.setNanos(t.getNanos());

    return ts;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:70,代码来源:JDBCResultSet.java

示例7: getDate

import org.hsqldb.types.TimestampData; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 *
 * Retrieves the value of the designated JDBC <code>DATE</code> parameter as a
 * <code>java.sql.Date</code> object, using
 * the given <code>Calendar</code> object
 * to construct the date.
 * With a <code>Calendar</code> object, the driver
 * can calculate the date 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 date
 * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
 *         is <code>null</code>.
 * @exception SQLException if a database access error occurs or
 * this method is called on a closed <code>CallableStatement</code>
 * @see #setDate
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *      JDBCParameterMetaData)
 */
public synchronized Date getDate(int parameterIndex,
                                 Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(parameterIndex,
        Type.SQL_DATE);
    long millis     = t.getSeconds() * 1000;
    int  zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);

    return new Date(millis - zoneOffset);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:46,代码来源:JDBCCallableStatement.java

示例8: getTimestamp

import org.hsqldb.types.TimestampData; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 *
 * Retrieves the value of the designated JDBC <code>TIMESTAMP</code> parameter as a
 * <code>java.sql.Timestamp</code> object, using
 * the given <code>Calendar</code> object to construct
 * the <code>Timestamp</code> object.
 * With a <code>Calendar</code> object, the driver
 * can calculate the timestamp 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 timestamp
 * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
 *         is <code>null</code>.
 * @exception SQLException if a database access error occurs or
 * this method is called on a closed <code>CallableStatement</code>
 * @see #setTimestamp
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *    JDBCParameterMetaData)
 */
public synchronized Timestamp getTimestamp(int parameterIndex,
        Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(parameterIndex,
        Type.SQL_TIMESTAMP);

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

    long millis = t.getSeconds() * 1000;

    if (parameterTypes[--parameterIndex].isDateTimeTypeWithZone()) {}
    else {

        // UTC - calZO == (UTC - sessZO) + (sessionZO - calZO)
        if (cal != null) {
            int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);

            millis += session.getZoneSeconds() * 1000 - zoneOffset;
        }
    }

    Timestamp ts = new Timestamp(millis);

    ts.setNanos(t.getNanos());

    return ts;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:65,代码来源:JDBCCallableStatement.java

示例9: getDate

import org.hsqldb.types.TimestampData; //导入方法依赖的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.Date</code> object
 * in the Java programming language.
 * This method uses the given calendar to construct an appropriate millisecond
 * value for the date if the underlying database does not store
 * timezone information.
 * <!-- end generic documentation -->
 *
 * @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 date
 * @return the column value as a <code>java.sql.Date</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 Date getDate(int columnIndex, Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(columnIndex,
        Type.SQL_DATE);
    long millis     = t.getSeconds() * 1000;
    int  zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);

    return new Date(millis - zoneOffset);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:31,代码来源:JDBCResultSet.java

示例10: getTimestamp

import org.hsqldb.types.TimestampData; //导入方法依赖的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.Timestamp</code> object
 * in the Java programming language.
 * This method uses the given calendar to construct an appropriate millisecond
 * value for the timestamp 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.Timestamp 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.Timestamp 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 timestamp
 * @return the column value as a <code>java.sql.Timestamp</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 Timestamp getTimestamp(int columnIndex,
                              Calendar cal) throws SQLException {

    TimestampData t = (TimestampData) getColumnInType(columnIndex,
        Type.SQL_TIMESTAMP);

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

    long millis = t.getSeconds() * 1000;

    if (resultMetaData.columnTypes[--columnIndex]
            .isDateTimeTypeWithZone()) {}
    else {

        // UTC - calZO == (UTC - sessZO) + (sessionZO - calZO)
        if (cal != null) {
            int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);

            millis += session.getZoneSeconds() * 1000 - zoneOffset;
        }
    }

    Timestamp ts = new Timestamp(millis);

    ts.setNanos(t.getNanos());

    return ts;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:69,代码来源:JDBCResultSet.java


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