Package org.hsqldb_voltpatches.types

Examples of org.hsqldb_voltpatches.types.TimestampData


        if (hasZone) {
            seconds -= zoneSeconds;
        }

        return new TimestampData(seconds, fraction, (int) zoneSeconds);
    }
View Full Code Here


    protected TimestampData readDate(Type type) throws IOException {

        long date = readLong();

        return new TimestampData(date);
    }
View Full Code Here

    }

    protected TimestampData readTimestamp(Type type) throws IOException {

        if (type.typeCode == Types.SQL_TIMESTAMP) {
            return new TimestampData(readLong(), readInt());
        } else {
            return new TimestampData(readLong(), readInt(), readInt());
        }
    }
View Full Code Here

        if (withZone) {
            if (currentTimestamp == null) {
                int nanos = (int) (currentMillis % 1000) * 1000000;

                currentTimestamp = new TimestampData((currentMillis / 1000),
                                                     nanos, timeZoneSeconds);
            }

            return currentTimestamp;
        } else {
            if (localTimestamp == null) {
                int nanos = (int) (currentMillis % 1000) * 1000000;

                localTimestamp = new TimestampData(currentMillis / 1000
                                                   + timeZoneSeconds, nanos,
                                                       0);
            }

            return localTimestamp;
View Full Code Here

     * @exception SQLException if a database access error occurs or this method is
     *            called on a closed result set
     */
    public Date getDate(int columnIndex) throws SQLException {

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

        if (t == null) {
            return null;
        }
View Full Code Here

     * @exception SQLException if a database access error occurs or this method is
     *            called on a closed result set
     */
    public Timestamp getTimestamp(int columnIndex) throws SQLException {

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

        if (t == null) {
            return null;
        }
View Full Code Here

     * @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);
    }
View Full Code Here

     *  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;
    }
View Full Code Here

        return testValue;
    }

    protected TimestampData getOrAddDate(long longKey) {

        TimestampData testValue;
        int  hash       = (int) longKey ^ (int) (longKey >>> 32);
        int  index      = hashIndex.getHashIndex(hash);
        int  lookup     = hashIndex.hashTable[index];
        int  lastLookup = -1;

        for (; lookup >= 0;
                lastLookup = lookup,
                lookup = hashIndex.getNextLookup(lookup)) {
            testValue = (TimestampData) objectKeyTable[lookup];

            if (testValue.getSeconds() == longKey) {
                if (accessCount == Integer.MAX_VALUE) {
                    resetAccessCount();
                }

                accessTable[lookup] = accessCount++;

                return testValue;
            }
        }

        if (hashIndex.elementCount >= threshold) {
            reset();

            return getOrAddDate(longKey);
        }

        lookup                 = hashIndex.linkNode(index, lastLookup);
        testValue              = new TimestampData(longKey);
        objectKeyTable[lookup] = testValue;

        if (accessCount == Integer.MAX_VALUE) {
            resetAccessCount();
        }
View Full Code Here

TOP

Related Classes of org.hsqldb_voltpatches.types.TimestampData

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.