All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.firebirdsql.jdbc.FBDatabaseMetaData Maven / Gradle / Ivy

There is a newer version: 2.2.15
Show newest version
/*
 * Firebird Open Source JavaEE Connector - JDBC Driver
 *
 * Distributable under LGPL license.
 * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * LGPL License for more details.
 *
 * This file was created by members of the firebird development team.
 * All individual contributions remain the Copyright (C) of those
 * individuals.  Contributors to this file are either listed here or
 * can be obtained from a source control history command.
 *
 * All rights reserved.
 */
package org.firebirdsql.jdbc;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.sql.RowIdLifetime;
import java.sql.SQLException;

import org.firebirdsql.gds.GDSException;

public class FBDatabaseMetaData extends AbstractDatabaseMetaData {

    public FBDatabaseMetaData(AbstractConnection c) throws GDSException {
        super(c);
    }

    /**
     * Indicates whether or not this data source supports the SQL ROWID type,
     * and if so  the lifetime for which a RowId object remains valid. 
     * 

* The returned int values have the following relationship: *

     *     ROWID_UNSUPPORTED < ROWID_VALID_OTHER < ROWID_VALID_TRANSACTION
     *         < ROWID_VALID_SESSION < ROWID_VALID_FOREVER
     * 
* so conditional logic such as *
     *     if (metadata.getRowIdLifetime() > DatabaseMetaData.ROWID_VALID_TRANSACTION)
     * 
* can be used. Valid Forever means valid across all Sessions, and valid for * a Session means valid across all its contained Transactions. * * @return the status indicating the lifetime of a RowId * @throws SQLException if a database access error occurs * @since 1.6 */ public RowIdLifetime getRowIdLifetime() throws SQLException { return RowIdLifetime.ROWID_UNSUPPORTED; } public int getJDBCMajorVersion() { return 4; } public int getJDBCMinorVersion() { try { String javaImplementation = AccessController.doPrivileged(new PrivilegedAction() { public String run() { return System.getProperty("java.specification.version"); } }); if (javaImplementation != null && "1.7".compareTo(javaImplementation) <= 0) { // JDK 1.7 or higher: JDBC 4.1 return 1; } else { // JDK 1.6 (or lower): JDBC 4.0 return 0; } } catch (RuntimeException ex) { // default to 0 (JDBC 4.0) when privileged call fails return 0; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy