Package org.hsqldb.types

Examples of org.hsqldb.types.TimestampData


                millis     += zoneOffset;
                zoneOffset = 0;

            // fall through
            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
                parameterValues[i] = new TimestampData(millis / 1000,
                        x.getNanos(), zoneOffset / 1000);

                break;
            case Types.SQL_TIME :
                millis     += zoneOffset;
View Full Code Here


     * this method is called on a closed <code>CallableStatement</code>
     * @see #setDate
     */
    public synchronized Date getDate(int parameterIndex) throws SQLException {

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

        if (t == null) {
            return null;
        }
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

     * @see #setTimestamp
     */
    public synchronized Timestamp getTimestamp(
            int parameterIndex) throws SQLException {

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

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

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

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

        // Do it.
        for (int i = 0; i < sessions.length; i++) {
            s              = sessions[i];
            row            = t.getEmptyRowData();
            row[isid]      = ValuePool.getLong(s.getId());
            row[ict]       = new TimestampData(s.getConnectTime() / 1000);
            row[iuname]    = s.getUsername();
            row[iis_admin] = ValuePool.getBoolean(s.isAdmin());
            row[iautocmt= ValuePool.getBoolean(s.isAutoCommit());
            row[ireadonly] = ValuePool.getBoolean(s.isReadOnlyDefault());
            row[imaxrows= ValuePool.getInt(s.getSQLMaxRows());
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

TOP

Related Classes of org.hsqldb.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.